Passing data from a form to a query

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?
 
K

Ken Snell [MVP]

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]
 

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

Top