Record Selection

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.
 
R

Roger Carlson

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
 
K

KP

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






.
 

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

Top