G
Guest
How do I code a button on a form to run a query and display the results in a
text box (on the current form)?
thank you!
text box (on the current form)?
thank you!
How do I code a button on a form to run a query and display the results in a
text box (on the current form)?
thank you!
fredg said:How do I code a button on a form to run a query and display the results in a
text box (on the current form)?
thank you!
How many records are returned by the query?
If just one all you need to display one field is:
[ControlName] = DLookUp("[FieldName]","QueryName")
If more than one record is returned, you can display one field, as
above, but you must add criteria (Where clause) to the DLookUp to get
the correct record.
If you need to see all the records, create a form to display them in.
Use the query as record source.
Then code a command button on a form:
DoCmd.OpenForm "FormName"
Lana said:You did not specify what was your task. May be my experience will be helpful
to you:
When I want to find some records (one or more) and I want the results to be
displayed in the same form, I make a button with a Macro:
Action:Apply Filter
Condition: [T_SPENT]![PREQ No] Like ("*"+[Enter PREQ Number]+"*").
In this case the dialogue window will open and ask me to "Enter PREQ
Number", and the results will be matching any part of the field to what you
entered.
You may change your condition to some unvariable, like:
Action:Apply Filter
Condition: [T_SPENT]![PREQ No] = "4"
Regards, Lana
eacollie said:How do I code a button on a form to run a query and display the results in a
text box (on the current form)?
thank you!