G
Guest
I want to archive records in a manpower table if any field is changed. When I open the form for the table I run:
General section:
Public Mdb As Database, SnapShotTemp As Recordset
Private Sub Form_Load()
Set Mdb = CurrentDb
Set SnapShotTemp = Mdb.OpenRecordset("Associate Info", dbOpenSnapshot)
Later when I close the form I want to compare (find unmatched) records between the table when the form was opened and the table when the form was closed. I created a string for my SQL statement which refers to SnapShotTemp
Dim Temptable1 As Recordset, OriginalRecs As QueryDef, ORTemptable As Recordset, SQLstringUnmatched1 As String
SQLstringUnmatched1 = "SELECT DISTINCTROW SnapShotTemp.AssOrigID, SnapShotTemp.[Associate Name - Last],........
Set OriginalRecs = Mdb.CreateQueryDef("", SQLstringUnmatched1)
Set ORTemptable = OriginalRecs.OpenRecordset()
Running this gives me the error:
Run-time error 3078
....cannot find the input table or query 'SnapShotTemp'. Make sure it exists and.....
And debug takes me to the last line of code I have provided.
How do I refer to a recordset in this SQL statement???
General section:
Public Mdb As Database, SnapShotTemp As Recordset
Private Sub Form_Load()
Set Mdb = CurrentDb
Set SnapShotTemp = Mdb.OpenRecordset("Associate Info", dbOpenSnapshot)
Later when I close the form I want to compare (find unmatched) records between the table when the form was opened and the table when the form was closed. I created a string for my SQL statement which refers to SnapShotTemp
Dim Temptable1 As Recordset, OriginalRecs As QueryDef, ORTemptable As Recordset, SQLstringUnmatched1 As String
SQLstringUnmatched1 = "SELECT DISTINCTROW SnapShotTemp.AssOrigID, SnapShotTemp.[Associate Name - Last],........
Set OriginalRecs = Mdb.CreateQueryDef("", SQLstringUnmatched1)
Set ORTemptable = OriginalRecs.OpenRecordset()
Running this gives me the error:
Run-time error 3078
....cannot find the input table or query 'SnapShotTemp'. Make sure it exists and.....
And debug takes me to the last line of code I have provided.
How do I refer to a recordset in this SQL statement???