Hi i am creating a db that connects to another accees db, in a different location and they may not be connected at all times. Therefore, i created a button in which allows them to connect to my db and compares their data to my db and updates or inserts records into my matser db.
The problem is that we are unable to get the recordset working, below is the code that refers to the button that connects to my master db.
Thanks for you help
Private Sub Command0_Click()
Dim WS As Workspace
Dim db As Database
Dim cn As rdoConnection
Dim rs As Recordset 'Our database
Dim rs2 As Recordset ' HeadOffice database
Set WS = CreateWorkspace("", "admin", "", dbUseJet)
Set db = WS.OpenDatabase("P:\TM reports access\DealerVisitReport.mdb", True)
strSql = "select * from DealerVisitReport"
Set rs2 = db.OpenRecordset(strSql)' this is the problem.!!!!
'rs2.Open strSql2, db.Connection, adOpenKeyset, adLockOptimistic
Set rs = New Recordset
strSql = "select * from [fakequery]"
rs.Open strSql, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
MsgBox " it worked!!!"
End Sub
The problem is that we are unable to get the recordset working, below is the code that refers to the button that connects to my master db.
Thanks for you help
Private Sub Command0_Click()
Dim WS As Workspace
Dim db As Database
Dim cn As rdoConnection
Dim rs As Recordset 'Our database
Dim rs2 As Recordset ' HeadOffice database
Set WS = CreateWorkspace("", "admin", "", dbUseJet)
Set db = WS.OpenDatabase("P:\TM reports access\DealerVisitReport.mdb", True)
strSql = "select * from DealerVisitReport"
Set rs2 = db.OpenRecordset(strSql)' this is the problem.!!!!
'rs2.Open strSql2, db.Connection, adOpenKeyset, adLockOptimistic
Set rs = New Recordset
strSql = "select * from [fakequery]"
rs.Open strSql, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
MsgBox " it worked!!!"
End Sub