UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Cancel Form Open on No Data    
 
   
debra_dixon
post Mar 3 2005, 01:49 PM
Post #1

UtterAccess Guru
Posts: 637
From: Virginia



I found the code to cancel the open and it works great. However, I'm calling the form from another form and once you close the message box about the no records, the Access default msgbox is coming up about the openform event canceled. I need to stop that. I've tried turning off the warnings on both forms. Please help. Thanks.
Go to the top of the page
 
+
Jack Cowley
post Mar 3 2005, 01:59 PM
Post #2

Retired Moderator
Posts: 37,716
From: The San Francisco Bay Area



I would use code like this in the On Click event of the button to open the form:

If DCount("*","tblNameOrQryName") = 0 Then
MsgBox "There are no records to display in the form you want to open."
Exit Sub
End If

Replace the 'tblNameOrQryName' with the name of the table or query the form you want to open is based on.

hth,
Jack
Go to the top of the page
 
+
debra_dixon
post Mar 3 2005, 02:08 PM
Post #3

UtterAccess Guru
Posts: 637
From: Virginia



Works great!! Thanks
Go to the top of the page
 
+
Jack Cowley
post Mar 3 2005, 02:13 PM
Post #4

Retired Moderator
Posts: 37,716
From: The San Francisco Bay Area



DeDe -

You are welcome and continued success with your project...

Jack
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 18th June 2013 - 09:41 PM