Parameter Query in form

twychopen22

Registered User.
Local time
Today, 00:15
Joined
Jul 31, 2006
Messages
101
Does anybody know how to have a text box on a form "satisfy" a parameter in a query? I want to enter two dates and have a subreport show information from them? (The records shown will only be between those two dates) How do I do this? (I don't want the parameter to pop up on form open) Something like (Date1) = Parameter1 (Date2) = Parameter2
 
I had to do something like this a few years ago.

I had the OnOpen event of a report open a form in dialog mode and feed it the calling report's name in openargs.

The dialog form had a number of text boxes for parameter inputs which were controlled by the name of the calling report.
There was also a global variable for each textbox on the form and a function for each global variable.

The on open event for the dialog form cleared all the global variables. When all the parameters were entered in the textboxes, the dialog form did a quick check to see that the values made sense (start date preceeded end date, etc) and then set each global variable equal to the contentes of the corresponding text box.

The functions were coded to look at the corresponding global variables and if they were empty, the function returned an asterisk and if they had a value, the function returned the value.

In the query, the criteria for the fields that needed it were set to:

Like Function()
 
Last edited:
Alright. Thanks so much for your help!!!! The only problem is that I don't understand all of what you are doing here. I need a report to open a form first? But i have a Form with dropdown that fills in my text boxes and 2 datetime pickers that are startdate and enddate. Can I do what you were saying with this? Thanks so much for your help
 
Last edited:
Your record has a date field. Use the "Between.. And" in your criteria and reference the fields.



Between [Forms]![FormName]![BeginningDate] And [Forms]![FormName]![EndingDate]
 
Allright, I have the query made in the combobox. I then referenced the 10th column (The one with your criteria) with the first and second date picker text boxes. Now when I click The combobox it asks for the parameters???
And another problem, the dropdown box is from one query and the report I want to show on the form is from another query. The first combobox just contains and fills in all the employee information. I want the Report on the form to show the employees name, parameters the dates, and then show the performance of that person (looking at the first combobox, then use the query for that persons performance.
 
Last edited:
Can I just have 3 queries one with the employee info, one with two date fields, one with the metrics (performance records) and then for the report on the form use those 3 queries to make 1? I guess I still have the problem of selecting the dates...Plz help!!! I'm lost!!!!
 
Last edited:
"Allright, I have the query made in the combobox. I then referenced the 10th column"
"Can I just have 3 queries one with the employee info, one with two date fields, one with the metrics (performance records) and then for the report on the form use those 3 queries to make 1?"

Without seeing your DB all this sounds rather strange.... Why 10 columns on a dropdown combo?
Why 3 queries? A query for each table? Are these tables related? If so, why not one query?
 
CEH said:
"Allright, I have the query made in the combobox. I then referenced the 10th column"
"Can I just have 3 queries one with the employee info, one with two date fields, one with the metrics (performance records) and then for the report on the form use those 3 queries to make 1?"

Without seeing your DB all this sounds rather strange.... Why 10 columns on a dropdown combo?
Why 3 queries? A query for each table? Are these tables related? If so, why not one query?

10 Columns are in a query, I don't use them all for a dropdown. Here is what I am doing...Using EmployeeInformationtbl (parent) getting 5 things: ID, Name, Position, Pay, Pay Method; then I want to select 2 dates...Then have a report show from EmployeeMetrictbl (child linked by Employee ID) showing: Employee name (from first selection), Dates (From selection of dates), MetricName, MetricsAchieved.
 

Users who are viewing this thread

Back
Top Bottom