Passing data from a form to a query

  • Thread starter Thread starter JoD
  • Start date Start date
J

JoD

I am an infrequest user of Microsoft Access. I am trying
to use a form to select a Quarter (1, 2, 3, 4). If the
quarter = 1, I need to pass the query Months 1 or 2 or 3.
When I type 1 or 2 or 3 directly into the criteria of the
query, I get the correct results. When I pass 1 or 2 or 3
from the form, I get nothing. Any ideas?
 
Because the form is receiving a single number, why not put a calculated
field in your query that matches the form's information? Put a calculated
field in the query that calculates the quarter number from the DateFieldName
field:

QtrValue: ((Month([DateFieldName]) - 1) \ 3) + 1

Then put this expression in the "Criteria:" box for this field:

[Forms]![FormName]![ControlNameOnForm]
 
Back
Top