Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 15th, 2008, 10:26 AM
Authorized User
 
Join Date: Mar 2008
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default Not Open Form when no data in query

I am using a macro to open a form for data entry with a criteria of machine number as "where" condition. The main form is based on a query and there are several related subforms all relating to the machine number. The problem I am having is that, if there is no data entered in the table for that machine number, I get a big blank screen. How do I get the form NOT to open when the query returns nothing for that machine number?
Reply With Quote
  #2 (permalink)  
Old August 15th, 2008, 02:44 PM
Authorized User
 
Join Date: Mar 2008
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

D'OH! I solved my problem for now, I just moved the "Close Form" button into the form header so it shows up now. Now, if nothing is scheduled to run on that machine, and the form is opened, at least they can get out of it. I would still like to know how to stop the form from opening in the first place.

Reply With Quote
  #3 (permalink)  
Old August 21st, 2008, 10:16 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Is this main form open by yet another form before it? If so, disable the button that opens it if there are no records to view.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
  #4 (permalink)  
Old August 21st, 2008, 10:50 AM
Authorized User
 
Join Date: Mar 2008
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, it is opened from another form. I'm not sure how to disable the button that way though. Do I somehow do it in the properties for the button or for the form??

Reply With Quote
  #5 (permalink)  
Old August 21st, 2008, 11:46 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

On the calling form's ON CURRENT event, see what the record ID is. Then use a DCOUNT function to count how many records in the called form's record source match that ID. If the DCOUNT is zero, disable the OPEN FORM button, otherwise enable the button.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Close all MdiChield form from open one form/Button salman .NET Framework 2.0 6 December 10th, 2007 03:21 AM
Open Form, run query, open form Grafixx01 Access 7 April 26th, 2007 11:32 AM
Query data in form Vince_421 Access 2 February 1st, 2007 10:45 AM
Copy data from Excel to open HTML form Bartje Excel VBA 1 September 29th, 2006 04:02 AM
How to Query XML Data from XSLT Form kwilliams XSLT 1 December 3rd, 2005 06:14 AM



All times are GMT -4. The time now is 09:25 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.