Filter

  • Thread starter Thread starter Jason MacKenzie
  • Start date Start date
J

Jason MacKenzie

I set a Form's filter property based on a combobox. I would like to pop up a
message box if there are no records that match the filter.

Any help is appreciated,

Jason MacKenzie
 
I generally make use of the Recordset.EOF property like
this:


Private Sub Form_Load()

Dim strMsgBoxTitle As String
Dim strMsgBoxPrompt As String
Dim intMsgBoxResponse As Integer

If Me.RecordsetClone.EOF And Me.RecordsetClone.BOF Then
strMsgBoxTitle = "No Records Found!"
strMsgBoxPrompt = "No records were found matching your
specified criteria. Please review "
strMsgBoxPrompt = strMsgBoxPrompt & "your settings and
try again."

intMsgBoxResponse = MsgBox(strMsgBoxPrompt, vbOKOnly,
strMsgBoxTitle)

DoCmd.Close acForm, "frmMyForm"

End If


End Sub


DBS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top