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

Passing value from parameter query to a field in a form

Status
Not open for further replies.

chloe67

Technical User
Mar 1, 2005
7
CA
Is there a way to pass the value entered in a parameter query into a field in a form?

I have a form that when opened will ask for a value. If the value is not found, a message box opens up asking if the user would like to add it. If the user clicks on OK, I would like for the value that they have entered into the parameter query to be automatically displayed in a field on the form so that they don't have to re-enter it.

Any advice would be greatly appreciated. Thanks!
 
I'm not quite clear on where the value comes from.

Does it come from a parameter prompt generated by your query by a statement like this on your criteria line?

Criteria
[Please enter a value]


Or does it come from an input box like this:

MyValue = InputBox$("Please enter a value")

Or does it come from a textbox on your form and then gets fed into your query?

Please clarify! [smile]

Tom

Born once die twice; born twice die once.
 
How are ya chloe67 . . .

You can't go back into a query and retrieve an entered parameter! However what you can do, instead of a parameter, set the value to that returned by a function. In that function you set an [blue]InputBox[/blue] that receives the user entry and set it as the return value of the function! . . . Since its VBA . . . its easy enough to update the control in question.

To make things easier, post back the parameter query . . .

Calvin.gif
See Ya! . . . . . .
 
Sounds as though you have a query which asks for a value within the SQL statement criteria. I've just been working on something similar and had to create a form which asks for the value. and used something like

nz([forms]![formname]![NameOfTheTextboxOnFTheForm],DefaultValueifNothingEntered)

in the criteria of the query field in question.

I hide the form after use and can use the entered value elsewhere in the database by copying it into a global variable or somewhere similar.



Ian Mayor (UK)
Program Error
Programming is 1% coding, 50% error checking and 49% sweat as your application bombs out in front of the client.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top