Inquiry form with no data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I check for no data and if there is not canel the opening of the form?
Something like the if no data event on a report?
 
How do I check for no data and if there is not canel the opening of the form?
Something like the if no data event on a report?


You can use this in the form's Load event:

If Me.RecordsetClone.RecordCount = 0 Then Cancel = True
 
When I do this I get a variable not defined error showing on 'Cancel ='
What am I missing?
 
The recordsource of your form is either a table or a query. Change your
current code that opens the form to look like this:

If DCount("*","NameOfTableOrQuery") <> 0 Then
DoCmd.OpenForm "NameOfForm"
Else
Msgbox "There is No data In The RecordSource Of The Form",,"Sorry No
Data"
End If

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
Back
Top