Keyword query

  • Thread starter Thread starter Guest
  • Start date Start date
Is there anyway to run a query from a text box?

You can use a form textbox as a criterion in a Query:

=[Forms]![NameOfYourForm]![NameOfYourTextbox]

on the criteria line.

You can "run" the query using a button on the Form, or using the
AfterUpdate event of the textbox; could you explain what you want to
do? Is it a select query, and you just want to see the data? If so,
base a Form or Report on the query and open that instead of the query
datasheet. Or is it an Action query, like an update or append query?

John W. Vinson[MVP]
 
Thanks for your help, but I had to change that textbox to a combobox and now
I need to query the combobox (Im have a query set up with the criteria
=[Query]![MyQuery]![ComboBox] and this works).

But I need the results from this query to show up in combobox2. (It will
show up with the results but it will not update if i change combobox1).

I need the results to change and show up in combobox2 when i change
combobox1. I have tryed to use a macro with the requery function but it
doesnt seem to do anything at all !

Thank for you help.

John Vinson said:
Is there anyway to run a query from a text box?

You can use a form textbox as a criterion in a Query:

=[Forms]![NameOfYourForm]![NameOfYourTextbox]

on the criteria line.

You can "run" the query using a button on the Form, or using the
AfterUpdate event of the textbox; could you explain what you want to
do? Is it a select query, and you just want to see the data? If so,
base a Form or Report on the query and open that instead of the query
datasheet. Or is it an Action query, like an update or append query?

John W. Vinson[MVP]
 
Thanks for your help, but I had to change that textbox to a combobox and now
I need to query the combobox (Im have a query set up with the criteria
=[Query]![MyQuery]![ComboBox] and this works).

But I need the results from this query to show up in combobox2. (It will
show up with the results but it will not update if i change combobox1).

I need the results to change and show up in combobox2 when i change
combobox1. I have tryed to use a macro with the requery function but it
doesnt seem to do anything at all !

Use the AfterUpdate Event Procedure of Combobox1. Click the ... icon
by the event; choose Code Builder; and edit it to read

Private Sub Combobox1_AfterUpdate()
Me!combobox2.Requery
End Sub

using your own control names of course.

John W. Vinson[MVP]
 
I put that in the same way you said and i keep getting this,

Enter Parameter Value
Form!UnitDataInput!cbArea

If i type in the value it works fine but it wont do it automaticly.


John Vinson said:
Thanks for your help, but I had to change that textbox to a combobox and now
I need to query the combobox (Im have a query set up with the criteria
=[Query]![MyQuery]![ComboBox] and this works).

But I need the results from this query to show up in combobox2. (It will
show up with the results but it will not update if i change combobox1).

I need the results to change and show up in combobox2 when i change
combobox1. I have tryed to use a macro with the requery function but it
doesnt seem to do anything at all !

Use the AfterUpdate Event Procedure of Combobox1. Click the ... icon
by the event; choose Code Builder; and edit it to read

Private Sub Combobox1_AfterUpdate()
Me!combobox2.Requery
End Sub

using your own control names of course.

John W. Vinson[MVP]
 
I found my problem. I forgot to add the s at the end of forms in the criteria
=/

Joel said:
I put that in the same way you said and i keep getting this,

Enter Parameter Value
Form!UnitDataInput!cbArea

If i type in the value it works fine but it wont do it automaticly.


John Vinson said:
Thanks for your help, but I had to change that textbox to a combobox and now
I need to query the combobox (Im have a query set up with the criteria
=[Query]![MyQuery]![ComboBox] and this works).

But I need the results from this query to show up in combobox2. (It will
show up with the results but it will not update if i change combobox1).

I need the results to change and show up in combobox2 when i change
combobox1. I have tryed to use a macro with the requery function but it
doesnt seem to do anything at all !

Use the AfterUpdate Event Procedure of Combobox1. Click the ... icon
by the event; choose Code Builder; and edit it to read

Private Sub Combobox1_AfterUpdate()
Me!combobox2.Requery
End Sub

using your own control names of course.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top