Filter

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
 
D

DBS

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
 
Top