Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter Form, Query and display form - checking for null value??

Status
Not open for further replies.

coder30

Programmer
Apr 7, 2006
16
US
I have a parameter form that feeds the memberID to a query, the query result is displayed in another form. If the memberID is not found in the query the resulting form is blank. I would like to display a label (or message box) that says "Member Not Found" instead of just a blank form result. I've tried to check if MemID object is null upon opening the resulting form, but that didn't work. I'm sure I have to check for null on the query, but code the event on the form. Does anyone know how I should code this event?

 
Hi!

You can open a recordset using the query and check if there are any records that way.

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Can you give me an idea of how this is done in VBA? I'm pretty new to coding outside of the typical event procedures.
 
Private Sub Form_Open(Cancel As Integer)
If Me.Recordset.EOF = True Then
DoCmd.Close
MsgBox "No data"
Else
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top