I am working on a form that is populated with records based on different filters. I want to be able to update a Yes/No field on one of the filtered records with code behind a button on the form (the field to update is not on the form). How can I reference the form that is currently visible?
I figured that I could use the CurrentRecord property, which does tell me what row in the recordset the record is in – but I’m not sure how to apply that information to my situation. Here’s what I have so far:
Private Sub cmdShowAgain_Click()
Dim recordnum As Integer
Dim strSql As String
Dim frm As Form
Set frm = Forms![frmQA]
recordnum = frm.CurrentRecord
DoCmd.SetWarnings False
strSql = “UPDATE tblQA SET tblQA.omit = 0 WHERE (????????????)
DoCmd.RunSQL strSql
DoCmd.SetWarnings True
End Sub
Thanks,
Randy