Form field linked to query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a subform that has 2 cbos. One for the month and one for the year.
These control the output for a query. I would like to have a field on this
subform that will display the results of the query when the user selects the
month and year. My problems are:
1. Hhow do I get the query to update after the user selects the month and year
2. How do I get the field to link with this query result?

Thanks for the help
 
Put logic in the combo box's AfterUpdate event to refresh the subform. Since
you can't be certain of what order the users will select the month and year,
you'll have to put the logic in both places (or, better still, write a
routine that both AfterUpdate events can call)
 
My problem is that I don't know the logic to put in. Also, how can I get
this form field to link with the query to show the results in the field?
 
Me.subformcontrolname.Form.Refresh

I don't understand what your second question means.
 
I am trying to get the form field's control source to be the query. Whenever
I link it, it gives me the Name? in the form field. My question is what do I
need to do to link this field to the query when my main form's control source
is a seperate table?
 
Still doesn't make any sense to me. What you mean by getting a form field's
control source to be a query? Do you mean you're trying to have the query
use the value that's in the control as a parameter? If so, where's the
field: on the form, or on the subform? How are you referring to it in the
query?
 
I need the result of the query to display in the field I have on my subform.
When the user selects the month and year, I want the query to run using the
after update feature and the result will display in this field I have on my
subform. When I am linking this subform field to the query I am using the
Expression Builder in the Control Source box to find the query and the query
field i want displayed but it gives the #Name? in the subform field.
 
If the query isn't the recordsource for the form, the only way to get a
result from it would be to use DLookup.
 
Back
Top