473,396 Members | 1,738 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,396 software developers and data experts.

Specify parameter to reports based on queries, then print

I have a series of forms based on queries. Each of these queries have the same parameter ("Product ID"), but pulls from different tables. The purpose of these different forms is to pull product specifications from their respective tables.

In a userform, I prompt the user for the parameter "Product ID" to run on a check on the last time the specs were reviewed. If the review date is recent enough, it allows the specs to be printed.

The problem I have, is that each time I got to print one of the reports, it asks for the parameters again. I would like to pass the parameter the user input when opening the form to each of the reports when they open. This would cut out about 5 pop up boxes.

Help!
Jun 10 '14 #1

✓ answered by twinnyfo

Curtis,

First, it sounds like the Query supporting the Report is looking for Product ID, but that value is not actually available, so, you are simply telling the Report what to look for. Try to drill down to the query first.

Along those same lines, if you want to limit the query based on the value entered by the User, as one of the criteria in your query, you can use the value entered on the form like such:

Expand|Select|Wrap|Line Numbers
  1. WHERE [Product_ID] = Forms![FormName]![txtProduct_ID]
This will allow the Report to print just the records associated with that Product ID.

Hope this hepps!

4 1018
twinnyfo
3,653 Expert Mod 2GB
Curtis,

First, it sounds like the Query supporting the Report is looking for Product ID, but that value is not actually available, so, you are simply telling the Report what to look for. Try to drill down to the query first.

Along those same lines, if you want to limit the query based on the value entered by the User, as one of the criteria in your query, you can use the value entered on the form like such:

Expand|Select|Wrap|Line Numbers
  1. WHERE [Product_ID] = Forms![FormName]![txtProduct_ID]
This will allow the Report to print just the records associated with that Product ID.

Hope this hepps!
Jun 10 '14 #2
Hi Twinnyfo,

Thanks for your answer.

So the Form (frmPrintCheck) pulls in a query (qryMMO) to get a value (ReviewDate) from that query to check when the most recent review was. Because of this, opening the form requires providing the parameter (ProductID) to the query (qryMMO).

After the review check, a series of Forms are opened the reference a series of queries, including qryMMO. Despite this, you have to re-enter the parameter.

I've tried making relationships, etc. to tie these queries together.


So i've tried to provide the WHERE criteria in the open report code:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "rptSpecs", acViewPreview,,[Product ID]=Me.[Product ID]
but that doesn't seem to change anything. Thoughts?
Jun 10 '14 #3
I think I figured out what you meant just now twinnyfo...

I went to the query and changed the criteria for [Product ID] to pull directly from the form itself.

Thank you so much!
Jun 10 '14 #4
twinnyfo
3,653 Expert Mod 2GB
Here's an idea, which I think will work:

In a separate, stand-alone module, establish a Global Variable and a quickie Function to use that variable in Queries:

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Public gProductID as [whatever data type the Product ID is]
  5.  
  6. Public Function ProductID() as [whatever data type the Product ID is]
  7.     ProductID = gProductID
  8. End Function
When the Form opens, ask the user to select the Product ID, in whatever method you desire. After the Product ID is selected or identified, establish the value of the Global Variable:

Expand|Select|Wrap|Line Numbers
  1. gRpoductID = me.txtProductID [or however you have established to set the Product ID]
Now, go back to the Query used for the Record Source for your Report. In the Product ID Field, in the Criteria, use this:

Expand|Select|Wrap|Line Numbers
  1. ProductID()
This should limit the records to only that Product ID.

Hope you understand this and that it hepps.
Jun 10 '14 #5

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

Similar topics

2
by: Bob M | last post by:
I've been trying to find a freeware front end to the MySQL database to create reports based on queries, and some sort of front-end which I can format for other users to use to load data into the...
0
by: Zentil | last post by:
While printing reports Spooling of print document size get increased into larger size ie the document size is 260kb but on spooling it increased to 268mb. but this is happening in some systems...
13
by: JayCallas | last post by:
I know this question has been asked. And the usual answer is don't use cursors or any other looping method. Instead, try to find a solution that uses set-based queries. But this brings up...
0
by: wojtek | last post by:
Hello, I have a task to create set of reports based on data from TFS source control. I must create these reports using reporting services technology.
0
by: crusoe | last post by:
I have some queries which return rowsets. I want to make XHTML tables from these sets in a single report file. My preliminary solution is a procedure, which returns varchar(8000) containing XHTML...
0
by: josur | last post by:
Hi, I would like to know if is possible to create dynamic reports based on cubes. What i mean is,after creating a cube with a couple of dimensions and measure if is there any way to give the...
4
by: kv29 | last post by:
Hi everyone! I really hope my problem will be a piece of cake for an expert coder :) I have a table with 100 records, and I need to print them all between 10 different reports based on each...
36
by: CK | last post by:
How do I write a set based query? I have a groupSets table with fields setId, idField, datasource, nameField, prefix, active Data: 1,someIDfield, someTable, someField, pre1, 1 2,someotherIDfield,...
11
by: jdoathout | last post by:
I have a database that needs to be deployed to a kiosk for civilian drivers. The Data is HIPPA Related and needs to be restricted to that individuals needs. However it all has to come together in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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.