Hello,
I am working on an access form when the cmdfilter button is clicked and there are no records matching the results I would like an addition form to open. Unfortunately, because there are no records both forms go blank. Below is my code:
I can get a message box to appear, but again all of the controls are removed from my forms.
Any help would be great!! Thank you!
I am working on an access form when the cmdfilter button is clicked and there are no records matching the results I would like an addition form to open. Unfortunately, because there are no records both forms go blank. Below is my code:
Code:
Private Sub cmdFilter_Click()
Dim rst As DAO.Recordset
Dim qdf As QueryDef
Dim db As Database
Set qdf = CurrentDb.QueryDefs("Get20Mile_SelQry")
qdf.Parameters(0) = Forms![frmMain]![txtZipCode]
Set rst = qdf.OpenRecordset(dbOpenDynaset)
Set Recordset = rst
If rst.EOF And rst.BOF Then
DoCmd.OpenForm ("frmError"), acNormal
End If
End Sub
I can get a message box to appear, but again all of the controls are removed from my forms.
Any help would be great!! Thank you!