Get info from form

krc547

Member
Local time
Today, 13:55
Joined
Sep 1, 2023
Messages
38
I have a query that I would like to get the dates from a form I have setup. The problem I am having is that there are formulas in the fields and I keep getting an error on the form when I try to run it.
 

Attachments

  • Acces Form.jpg
    Acces Form.jpg
    116.3 KB · Views: 127
A field parameter need to be fully defined
Forms!YourFormName!YourControlName
you only have a control name as far as I can tell so the query has no idea where that control is.
 
Yes, when I add [forms]![fadaseniors]![startdate] in the criteria field the form still errors.
 
When you did that did the expression builder show startdate? Just checking to see you got the correct control name.
What is the error?
To make it a little easier you could put two calculated controls on your form and hide them.
txtMonth; = month([startdate])
txtYear: = iif(month([startDate]) > 7, year([startDate]) + 1, year([startDate]))
this way you can first check that you are getting the correct values
then reference txtmonth and txtyear in the query

Doing parameter queries and calculated ones are hard because you cannot debug easily. That could take a little out of it because you can verify at the form that the values are correct and make the query easier.
 
What if I took those two fields out and did a Between in the criteria referencing the startdate and the enddate on the form?
 
I did not notice those fields are Group By and I think you want Where.
 
So I changed my Query and the form opens now but will not let me enter a date in the fields on the form.
Screenshot 2024-02-29 Access.png
Screenshot 2024-02-29 Access2.png
 
Do you have allow edits = no. If the form is read only but you want to enter into the unbound controls either lock the controls individually or make the query uneditable. The former is probably easier.
 
Ok so the form is letting me enter dates now but it is a continuous form and it is not loading the data. The query runs the data just fine.
 
continuous form and it is not loading the data.
What does that mean? What is supposed to happen? Can you post the DB?
 
Nevermind. I needed the form to Requery once they enter the dates so the query can grab the information. Thank you.
 
Nevermind. I needed the form to Requery once they enter the dates so the query can grab the information. Thank you.
You are mis using the Requery to force Access to save the current record.
 

Users who are viewing this thread

Back
Top Bottom