Hello. I have a form that displays search results. When the user clicks on a certain record, a macro saves the "ID" value (number) to a TempVar (AccredID_Set).
I then have a macro that opens a new form showing all accreds of the unit the person selected. I would like to SetFocus on the exact record the person selected in the search result form. (So the person doesnt have to go searching through the records again.)
I need to figure out how to set focus based on matching the Accred ID of the new form with the AccredID of the old form. (Saved as a TempVar). I am not finding the syntax or where I should stick the code... (On Load?)
Thanks for the help!
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "YourFieldName=" & Tempvars!YourTempvarName
If Not rst.NoMatch Then Me.Bookmark = rst.Bookmark
Note that assume YOurFieldName is a Numeric datatttype. If it's a Text datatype:
rst.FindFirst "YourFieldName='" & Tempvars!YourTempvarName & "'"