[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 57
  • Last Modified:

Access Forms Queries

I do not want the second form to query due to no paramaters entered (seems like On Open might help but not sure how to do it).

What I would like is to access the second form from the main page and have the two reports below show zero record (without going throught the query process).  

How the database currently works

Step 1 - From main page "Button One-Components is pressed.
Step 2 - Form "Component Form Page" is opened.
Step 3 - Access automatically runs Query 1 and Query 2 as a means to populate Report 1 and Report 2 even though there are no parameters (wastes time).

Can you help?

Main Form

                           
Button one - Components
 
                                                                                                                             Submit Button


Second Form "Component Form Page"

                           
Input One
                           
Input Two

                            Report 1  Query 1

                            Report 2  Query 2
0
gazdzid
Asked:
gazdzid
1 Solution
 
hnasrCommented:
Upload a sample database and direct us what to do to experience the problem.
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Why does "Access automatically runs Query 1 and Query 2"? The only time Access will "automatically" do something is if you've told it to, or if you've bound an object (like a Form or Report) to that query. If you only want the second form to open your reports AFTER the two parameters are entered, then check for those values before you run code that opens the report:

If Nz(me.ParameterOne, "") = "" Then
  Msgbox "You must enter Parameter One"
  Exit Sub
End If

If Nz(me.ParameterTwo, "") = "" Then
  Msgbox "You must enter Parameter Two"
  Exit Sub
End If

DoCmd.OpenReport "YourReport" etc etc

Obviously you'd have to change that to match field and Report names in your project.

Note that if you're using 2010 or higher, and you've Embedded those reports on the Form, then Access will always try to run them. The only way around that would be to remove the SourceObject value from those embedded SubReport objects, and set them only when your parameters tests above are completed.
0
 
Anthony PerkinsCommented:
Topics: Microsoft Access Database ,MS SQL Server
Does this question have anything to do with MS SQL Server?
0
 
MacroShadowCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Accept: Scott McDaniel (Microsoft Access MVP - EE MVE ) (http:#a40196535)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

MacroShadow
Experts-Exchange Cleanup Volunteer
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now