I'm having a problem with a function that is called from the On Current event of several different forms. The purpose of the function is to record the ID number of each record, so that I have this value available to use in an audit trail program when I delete a record. This is the code:
Function StoreIDs()
Dim frm As Form
Set frm = Screen.ActiveForm
strPrevID = strCurrID
strCurrID = frm!RecordID
End Function
This code works fine as long as I'm moving from record to record within a form. But when I close the form and reopen it, I get the following error message when the program reaches the ActiveForm statement: "Error 2475 You entered an expression that requires a form to be the active window
Function StoreIDs()
Dim frm As Form
Set frm = Screen.ActiveForm
strPrevID = strCurrID
strCurrID = frm!RecordID
End Function
This code works fine as long as I'm moving from record to record within a form. But when I close the form and reopen it, I get the following error message when the program reaches the ActiveForm statement: "Error 2475 You entered an expression that requires a form to be the active window