473,394 Members | 1,802 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

conditional report loading based on query result

13
I am trying to create a form that when submitted it checks a query total result. If the result is 0 i want to load "rpt_1" otherwise I want it to load "rpt_2". I have everything setup, but I just don't know the syntax to get the result into the form to check it and compare it.

Thanks.
Jun 15 '07 #1
1 1140
puppydogbuddy
1,923 Expert 1GB
I am trying to create a form that when submitted it checks a query total result. If the result is 0 i want to load "rpt_1" otherwise I want it to load "rpt_2". I have everything setup, but I just don't know the syntax to get the result into the form to check it and compare it.

Thanks.
1. Add a textbox control to the form, set its control source property ---> yourquery
2. I assume that your use of the word "submitted" means clicking a button. If so, then the code behind the button would be as follows:
Expand|Select|Wrap|Line Numbers
  1. Private Sub btnOpenRpt_Click()
  2. If Me!MyTextbox.Value = 0 Then
  3.       DoCmd.OpenReport "rept_1", acViewPreview
  4. Else
  5.       DoCmd.OpenReport "rept_2" , acViewPreview
  6. End If
  7.  
Replace yourquery and MyTexbox with the actual names of those objects in your application.
Jun 15 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: aww | last post by:
Hi, I have four records displayed for one client with four different dates and four different services. One of those services requires I send additional information. I created a query that...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
3
by: RC | last post by:
I can't quite grasp the concept of creating custom reports depending upon what options a user picks on a Form. For example, the user clicks on a "Print Reports" button and a Form pops up. On the...
1
by: Craig M | last post by:
Hi, I've created a query that has all calculations needed, and made a report based on this. I have then made a form based on this query. What I would like to do is print only the current...
0
by: Kevin Carter | last post by:
Hi I have a report based on a query inserted into the report is sub report based on the result of the first query(second query) At the moment the second query returns two values(which is...
1
by: John | last post by:
My report is based off of a table. I need a record on the report to be highlighted if that record ID is in a different table. Something like, if record ID exists in Query X, then conditional format...
3
by: Chuck Reed | last post by:
I am working on a sales report where I show weekly sales by category for each of the 52 weeks in the year. Each record in my table/report has the 52 weeks of sales in it. I want to highlight to top...
7
by: Blue Bell Trading - Customer Services | last post by:
Hi, I am trying to get a bound text box on a form to change its value based on the field stored in the form. Is this correct?... If Me. = "Completed" Then Me. = "YES" End If I do not know...
32
by: wexx | last post by:
I have been looking for some time now (reading books off Safari, searching through forums,etc) I have found no solution to this problem. I turn to anyone of you that may be able to help me. I'm...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.