querying a query

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

Guest

I have a query-based form which comes up blank if the query comes up blank
I'd like to display a MsgBox error message when that happens
How can I ask the query if it found a record or not
or, is there another way to do this
the Detail section of the form remains blank if there is no data. Can I trigger on this instead?
 
Put the following code in the OnOpen event of the form:

Dim Rst As DAO.Recordset
Set Rst = Me.RecordsetClone
If Rst.Recordcount = 0 Then
MsgBox "Your message"
Cancel = True
End If
Rst.Close
Set Rst = Nothing


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com




Desert Bear said:
I have a query-based form which comes up blank if the query comes up blank.
I'd like to display a MsgBox error message when that happens.
How can I ask the query if it found a record or not?
or, is there another way to do this?
the Detail section of the form remains blank if there is no data. Can I
trigger on this instead?
 
Back
Top