Hi,
I've got this code:
Dim dbMidbase As Database
Dim rsMidbase As Recordset
Dim sSql As String
sSql = "SELECT [Documents]![DRegistrationNumber], [Jobs]![Job No], [Jobs]![Department], [Jobs]![Job Name] FROM Documents INNER JOIN Jobs ON [Documents]![DOurJob] = [Jobs]![Job No]WHERE ((([Documents]![DRegistrationNumber])=[Forms]![Transmissions]![TDRegCombo]))"
Set dbMidbase = OpenDatabase("\\location\midbdata97.mdb"
Set rsMidbase = dbMidbase.OpenRecordset(sSql) '***
The function has error trapping: it get's caught on the line ***. I don't know if this is because I have a problem in my SQL statement, or if there is something incorrect in my dealing with a recordset. I have very little idea on the correct use of recordsets: the recordset that I am trying to create here is a temporary combination of tables (as delivered by the SQL statement - if I put it into an Access query and run it, it works exactly as I want it to), from which the information can be used (to put into a word document). I don't need to make any changes/additions to the data - simply get the information out of it and then 'throw' the recordset away.
I've been stuck on this for days, so any help would be greatly appreciated. I'm sure I'm just doing doing something small and incredibly stupid, but I can't for the life of me figure out what it is.
Thanks muchly.
I've got this code:
Dim dbMidbase As Database
Dim rsMidbase As Recordset
Dim sSql As String
sSql = "SELECT [Documents]![DRegistrationNumber], [Jobs]![Job No], [Jobs]![Department], [Jobs]![Job Name] FROM Documents INNER JOIN Jobs ON [Documents]![DOurJob] = [Jobs]![Job No]WHERE ((([Documents]![DRegistrationNumber])=[Forms]![Transmissions]![TDRegCombo]))"
Set dbMidbase = OpenDatabase("\\location\midbdata97.mdb"
Set rsMidbase = dbMidbase.OpenRecordset(sSql) '***
The function has error trapping: it get's caught on the line ***. I don't know if this is because I have a problem in my SQL statement, or if there is something incorrect in my dealing with a recordset. I have very little idea on the correct use of recordsets: the recordset that I am trying to create here is a temporary combination of tables (as delivered by the SQL statement - if I put it into an Access query and run it, it works exactly as I want it to), from which the information can be used (to put into a word document). I don't need to make any changes/additions to the data - simply get the information out of it and then 'throw' the recordset away.
I've been stuck on this for days, so any help would be greatly appreciated. I'm sure I'm just doing doing something small and incredibly stupid, but I can't for the life of me figure out what it is.
Thanks muchly.