Run Query from form textbox using vba

RiskyP

Registered User.
Local time
Today, 10:14
Joined
Jan 3, 2013
Messages
27
Hello,

Not sure weather to place this under from or query thread.

Could somebody please point me in the right direction - I have a form with a textbox, in this texbox the user enters to ID number of a product. I would like when the users hits the enter key, to open the 'edit' form showing the particular product.

I have a query set up that runs off ID number, but I just can't figure out how to set the query ID number to the value of my textbox

Any help would be greatly appreciated

P
 
You could use the textboxes on exit event to run code to run the query

Brian
 
Or does this

I have a query set up that runs off ID number, but I just can't figure out how to set the query ID number to the value of my textbox

mean that you don't know how to write the criteria in the query

Forms!formname!formcontrolname

Brian
 
Well not trying to come accross a daft - but I am much more use to excel. But I understand the on exit event (easy enough) It's just how do I populate the query search permaeter with my textbox value?

If it is as below - would this initiate from the on exit event (if I tell it to load the edit form which is conected to the query)? and if so - what if I wanted to use VBA to manipulate the data before running the query?

Hope it this makes sense

Thanks
P

Or does this



mean that you don't know how to write the criteria in the query

Forms!formname!formcontrolname

Brian
 
Do you mean the data in the textbox, if so yes you can do what you like in the code if the data is accessible. The textbox will be accessible with
ME.textboxname
if the name contains no blanks or special characters , except _ it will be listed in the dropdown after typing Me.

Brian
 
Thanks for your help - just runs straight off the textbox - diddn't realise it would be that simple

P

Do you mean the data in the textbox, if so yes you can do what you like in the code if the data is accessible. The textbox will be accessible with
ME.textboxname
if the name contains no blanks or special characters , except _ it will be listed in the dropdown after typing Me.

Brian
 

Users who are viewing this thread

Back
Top Bottom