RIPLavabit
New Member
- Joined
- Aug 14, 2013
- Messages
- 3
Code:
<code>
</code> Dim Data1 As String
Dim Data2 As String
Dim Data3 As String
Dim Data4 As String
'Using the AddNew method of the Recordset object
Private Sub Method1()
Dim adoRecordset As ADODB.Recordset
Data1 = "hello"
Data2 = "hello2"
Data3 = "hello3"
Data4 = "hello4"
Set adoRecordset = New ADODB.Recordset
With adoRecordset
.Open "SELECT a,b,c,d FROM test", adoConnection, adOpenKeyset, adLockOptimistic
.AddNew
.Fields("a").Value = Data1
.Fields("b").Value = Data2
.Fields("c").Value = Data3
.Fields("d").Value = Data4
.Update
.Close
End With
Set adoRecordset = Nothing
MsgBox "Done using method1. ", vbExclamation, "Recordset.AddNew"
End Sub
Private Sub add_Click()
Method1
End Sub
<code></code>
Code:
Option Explicit
Public adoConnection As ADODB.Connection
Public Sub Main()
Set adoConnection = New ADODB.Connection
adoConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= " & App.Path & "\dbAdd.mdb;"
adoConnection.Open
frmAdd.Show
End Sub
Is there any fix for this, the debugger highlights this line
Code:
<code>adoConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source= " & App.Path & "\dbAdd.mdb;"
Last edited: