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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing along a value in a form

Status
Not open for further replies.

lous

Technical User
Mar 8, 2002
53
US
I have a form that has a few buttons on it that run queries. These queries ask for an account number when you run them.

The problem is, I have that accout number in a text box on the form already. How can I pass along that number into the "Enter parameter" box so that the query will use that number on the form automatically?

Thanks.
 
Create a table called tblMain with a column called Name
create a form Named frmMain with a unbound textbox called Name and a button that will open up the query
create a query linked to tblMain and the Name column, now under the name column in the criteria section you will type in
=Forms!frmMain!Name

Now go back to the form you created make sure you link the button you created to open the query to the proper query type in a name that is already in the database in the unbound textbox when you click on the button to open the query it will automaticaly filter for that name.

You can modify this example to suit your needs

if you have any questions let me know
 
Hello,

Thanks for the help! That does work, but now I have another problem.

When I click the button, it brings up all the information in a query table. How can I get it to print in a report? I've tried linking it but it keeps bringing up the Enter Parameter box. Any ideas?

Thanks.
 
I am not sure I understand you correctly do you want another button that will open a report that only looks up data that matches your form.
 
Here's how I'd like it to work.

The person opens up the form then types in an account number. This runs a query that pulls the name and address of the store and displays it on the form.

Now let's say that I want to run a report to see why they called in the past. I click a button and it asks me to type in an account number ("Enter Parameter"). But I don't want to have to retype it. I just want it to use the same account number that's already on the form.

Does this help out any? If not, I'll send you an example of what I'm trying to say.

Thanks!
 
Hey there lous,

I have a question for you. when the app askes you for the input is this done in vba or on the query using the [EnterValue] in the criteria for the input.

In the case of the latter one and yoiu don't want to start using vba then use the ...Build command in the criteria area of the query. To get there use your left mouse button and select Build, it is near the bottom of the option list. In there you can select the form that you are using and the textbox with the information in it.

Or you could start using vba to send the information over.

I hope this helps

Urbane Rove
 
Got it figured out, thanks all!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top