Record Selection

  • Thread starter Thread starter KP
  • Start date Start date
K

KP

Hi, I hope you are having a great day.

I have form based on query that checks a yes/no field for
yes matching records, i.e., were any parts on order. When
I open form and there are matches, I get said records.
When no records match, I get a blank form. Is there a way
to have a MsgBox display (No Matching Records Found)
instead of a blank form? If so, how I make it do that?

Thanks in advance and have a great day.
 
You could try this in the On Load event of the form:

Private Sub Form_Load()
If Me.RecordsetClone.EOF Then
MsgBox "No Records"
DoCmd.Close
End If
End Sub
 
Thanks Roger, that did the trick.
-----Original Message-----
You could try this in the On Load event of the form:

Private Sub Form_Load()
If Me.RecordsetClone.EOF Then
MsgBox "No Records"
DoCmd.Close
End If
End Sub

--
--Roger Carlson
www.rogersaccesslibrary.com
Reply to: Roger dot Carlson at Spectrum-Health dot Org






.
 
Back
Top