I am able to save the record value in a table on the form unload, however, I cannot restore the form to the record indicated in the table.
"txtID" = ID value in the form
"tblRestore" = hidden table to store record value
The error message 3070 indicates that there is a problem with the line: rstFrm.FindFirst "[txtID] = '" & rst![Value] & "'"
What is wrong with my code?
*****
Private Sub Form_Load()
Dim db As Database, rst As Recordset, rstFrm As Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("tblRestore")
rst.Index = "PrimaryKey"
rst.Seek "=", "CustomerIDLast"
If Not rst.NoMatch Then
If Not IsNull(rst![Value]) Then
Set rstFrm = Me.RecordsetClone
rstFrm.FindFirst "[txtID] = '" & rst![Value] & "'"
If Not rstFrm.NoMatch Then
Me.Bookmark = rstFrm.Bookmark
End If
rstFrm.Close
End If
End If
End Sub
"txtID" = ID value in the form
"tblRestore" = hidden table to store record value
The error message 3070 indicates that there is a problem with the line: rstFrm.FindFirst "[txtID] = '" & rst![Value] & "'"
What is wrong with my code?
*****
Private Sub Form_Load()
Dim db As Database, rst As Recordset, rstFrm As Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("tblRestore")
rst.Index = "PrimaryKey"
rst.Seek "=", "CustomerIDLast"
If Not rst.NoMatch Then
If Not IsNull(rst![Value]) Then
Set rstFrm = Me.RecordsetClone
rstFrm.FindFirst "[txtID] = '" & rst![Value] & "'"
If Not rstFrm.NoMatch Then
Me.Bookmark = rstFrm.Bookmark
End If
rstFrm.Close
End If
End If
End Sub