Janet Thomas
Registered User.
- Local time
- Today, 11:12
- Joined
- Aug 15, 2002
- Messages
- 20
I am opening a form from another form using a command button. On click, I have Do.Cmd OpenForm...etc. with a where clause (built from information on this first form). This is working fine if I enter information which results in records being found.
My question is how to check if the where clause results in no data? I thought the following would work as I've used it in other forms (not ones where I'm passing a where clause though):
If Me.Recordset.RecordCount = 0 Then
MsgBox "No Data found for Selection - try again"
DoCmd.Close
End If
I have tried putting this on every event I can think of in the second form... Current, Open, Load, Got Focus, On Filter, Apply Filter - nothing works. I see a very brief flash of information and then my form goes completely grey. Can anyone help?
My question is how to check if the where clause results in no data? I thought the following would work as I've used it in other forms (not ones where I'm passing a where clause though):
If Me.Recordset.RecordCount = 0 Then
MsgBox "No Data found for Selection - try again"
DoCmd.Close
End If
I have tried putting this on every event I can think of in the second form... Current, Open, Load, Got Focus, On Filter, Apply Filter - nothing works. I see a very brief flash of information and then my form goes completely grey. Can anyone help?