Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Take Parameter Query Entry and Display on the Form 1

Status
Not open for further replies.

GLG123

Technical User
May 4, 2006
10
0
0
US
It's likely very easy. I'm new to this and I guess I'm not writing an expression the correct way. What I've done is put a TextBox on FORMa. FORMa is based on QUERYa. In QUERYa, FIELDa has criteria that needs INPUTa.

I want what is typed in for INPUTa to show in TextBox on FORMa.

For the TextBox Control Source Property I wrote the expression:

=[Forms]![FORMa]![INPUTa]

I don't know if it's just a syntax issue, a reference thing; or am I just going about it the wrong way.

Any help appreciated.
TIA
 
How are ya GLG123 . . .

Instead of the parameter use a [blue]Custom Function[/blue] that returns the value from an [blue]InputBox![/blue] Within the function you store the value in a [blue]global variable[/blue]. Then in the [blue]Onload[/blue] event of the form you set the textbox to the global variable . . .

Your thoughts?

Calvin.gif
See Ya! . . . . . .
 
If I read you correctly, the Textbox is on the same form as INPUTa, in which case set its Control Source to:
=[INPUTa].

In order to use this as a criteria for a query, open and minimize FORMa so that it is loaded. Open QUERYa in design view. Right click in the criteria row of FIELDa and click Build. Double click the Forms button, then double click Loaded Forms. Locate and double click whichever of the two you want to use for criteria.

The syntax should resemble something like this:
Forms![FORMa]![FIELDa]. NOTE: the =[/color red] symbol should not be needed.

Hope this helps.

Tom
 
Thomas,
INPUTa is a parameter input box that pops up before the query or the form referencing the query. Basically I want to take whatever is input there and show it on the form.

AceMan,
I like the way you're approaching it; it seems it would solve another reason I want to do this.
Reason 1) I wanted the form to show the user what their input parameters are.
Reason 2) Pass these same parameters onto reports/misc.

As of now what happens is: I'll open my form, and my parameter box pops up. I enter in a number or set of dates (depending on which form). The form will show me the records that meet the criteria. From there, I'm trying to print either single records, filtered records, and/or all the records shown in the query (three separate buttons). I've been able to do that with a form based off a table only, with no issues; it works great. What bugs me about trying it with the query forms, when I go to print, it re-request my parameters and I don't want it to. I've already given them. Another problem is when applying a filter. When I filter the query forms, it also re-request my parameters. So I figured there should be a way to keep it from doing that.

Anyway that's the more advanced situation. I'm slowly approaching this thing a few different ways. Unfortunately I don't know enough. I think using a variable that scopes the time the particular form is open is a smart way to go. Setting and applying it where I need is beyond me.

baby steps
 
GLG123 . . .

Realize that [blue]the function approach will behave exactly like the parameter[/blue], the function simply affords you the means to save/display the user input.

The tricky part will be the reports [blue]RecordSource[/blue]. It will no longer be the query with parameters in criteria, it will be the [blue]equivalent SQL with criteria concatenate from the values stored on the form by the function[/blue]. Now the reports open unscaved.

I hope this makes sense . . .

Calvin.gif
See Ya! . . . . . .
 
Question on ThomasLafferty (Instructor) post.
When I attempt to use the 'Forms![frmProjectManagers]![ProdGrpID]!' from the build, it will not work on my crosstab query, I get the following error:
"The MS Jet database does not recognize '[Forms]![frmProjectManagers]![ProdGrpID]!' as a valid name or expression."

It works fine on my other queries that are not crosstabs. is there a limitation in Access or am I doing something wrong?

Lpbruce
 
You have to declare [Forms]![frmProjectManagers]![ProdGrpID] as a parameter in your crosstab query.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top