Text Fields on Form to Parameters in Query
Hello,
I'm just learning (slowly), and am having trouble with the following.
I've got a query in MS Access (2003) with parameters of "city", "startDate" and "endDate". These are fixed so when you open the query, the parameter windows pop up for you to fill in.
I am trying to create a form where a user can fill in the above information, click the button and have the user defined text fields take the place of those parameter windows above. (Or have them collect the info from the form and not pop up.)
Also, I would like for a field of the query result to show in a separate text box on the form once complete. (This would be a percentage that I would need a format change from the query result.)
Thanks in advance for your assistance!
Re: Text Fields on Form to Parameters in Query
Welcome to the forums! :wave:
You will need to use a Command object. Have a look at this, included is using a query to add a record, you can modify it to suit your need.
Re: Text Fields on Form to Parameters in Query
Thanks for the reply!
I actually was able to fix it with some simple steps! To fill in the parameter prompts, I did the following:
DoCmd.OpenQuery "qryNPSbyCity"
[City] = Me.City
[StartDate] = Me.StartDate
[EndDate] = Me.EndDate
and to fill in the value from the query to the form, I used:
Me.NPS.Value = DLookup("NPS", "qryNPSbyCity")
Then I added:
DoCmd.Close acQuery, "qryNPSbyCity"
to remove the open query from the screen.
Pretty exciting! ;)
Re: Text Fields on Form to Parameters in Query
If your problem has been solved then you can now mark your thread as resolved using the Thread Tools menu.