> I am new to writing code in access, but have managed to build a large
> database, with security and the works. I've been pulling my hair out trying
[quoted text clipped - 7 lines]
> been frustrating me for the past week.
> Let me know if my explanation isnt clear enough. Thanks...
You cannot stop the query from displaying even if there are no
records.
What you can do is .....
Create another form to display the results of the query (i.e. make the
query this new form's record source.
Set the Form's Default View property to Datasheet.
Records will be displayed the same as query datasheet view.
Code this form's Open Event:
If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "No records to display" ' This is optional if you want
Cancel = true ' stops the form from opening
End if
Then instead of opening the query, open this form. You will need to
use error handling as the above cancelling of the form opening will
generate error 3021.
On Error GoTo Err_Handler
DoCmd.OpenForm "FormName"
Exit_Sub
Exit Sub
Err_Handler:
If Err = 3021 Then
Else
MsgBox "Error #: " & Err.Number & " " & Err.Description
End If
Resume Exit_Sub

Signature
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
mowol - 18 Jan 2006 19:20 GMT
Thanks soo much!! It works like a champ! Like I said, I figured it was a
simple fix, but just couldn't get my head around it. Thanks again!!
> > I am new to writing code in access, but have managed to build a large
> > database, with security and the works. I've been pulling my hair out trying
[quoted text clipped - 38 lines]
> End If
> Resume Exit_Sub