I have a problem with the following code. It is not recognising the following variable:
objRecordSet
My knowledge of Access is only in the beginner stage. I have seen plenty of examples of code online that use this but for some reason I canlt get it to work
Sub Populate_Funds()
'On Error Resume Next
Const adOpenStatic = 3
Const adLockOptimistic = 3
Dim objConnection As Object
Dim objRecordSet As ADODB.Recordset
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
'Set objRecordSet = New ADODB.Recordset
objConnection.Open _
"Provider = Microsoft.Jet.OLEDB.4.0; " & _
"Data Source = C:\Documents and Settings\ppanebianco\Desktop\Funds Table.mdb"
objRecordSet.Open "SELECT * FROM GeneralProperties", _
objConnection, adOpenStatic, adLockOptimistic
objRecordSet.AddNew
objRecordSet("Fund") = "atl-ws-99"
objRecordSet("Department") = "Human Resources"
objRecordSet("OperatingSystem") = "Microsoft Windows XP Professional"
objRecordSet.Update
objRecordSet.Close
objConnection.Close
End Sub
objRecordSet
My knowledge of Access is only in the beginner stage. I have seen plenty of examples of code online that use this but for some reason I canlt get it to work
Sub Populate_Funds()
'On Error Resume Next
Const adOpenStatic = 3
Const adLockOptimistic = 3
Dim objConnection As Object
Dim objRecordSet As ADODB.Recordset
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
'Set objRecordSet = New ADODB.Recordset
objConnection.Open _
"Provider = Microsoft.Jet.OLEDB.4.0; " & _
"Data Source = C:\Documents and Settings\ppanebianco\Desktop\Funds Table.mdb"
objRecordSet.Open "SELECT * FROM GeneralProperties", _
objConnection, adOpenStatic, adLockOptimistic
objRecordSet.AddNew
objRecordSet("Fund") = "atl-ws-99"
objRecordSet("Department") = "Human Resources"
objRecordSet("OperatingSystem") = "Microsoft Windows XP Professional"
objRecordSet.Update
objRecordSet.Close
objConnection.Close
End Sub