What if you want to view siteID =3? This seems like a very inflexible requirement. I'm pretty sure you would want to do this on the form that opens the form we're talking about and use the Where argument.
By "last" we're going to assume either the highest autonumber or otherwise, you'll need to have a date added field that includes time and then "last" refers to the highest value for that field.
Thank you very much for all the hints, but unfortunately I still haven't picked up on the problem. Sorry to bother you, but I've only been in Access for 6 months.
I'm sorry it's my fault. I have never been able to explain exactly what I mean. So, this is: when the user opens access, The form is popup that allows him to choose the shift option.
Then, by pressing the "New Record" button, the user is directed to the "Form1", which is built based on the "TblMainAndPlaner" table. A new record is then opened using the macro button-> event-> on click-> open form->(Form1) Where condition -> = "[ShiftDate] =" & "#" & [Auto_Date] & "#".
the date automatically appears. Also the site ID (Text box) is set as default Data-> Default value = 3.
All this works fine if we are talking about opening a new record. The date and SiteID come from one table, "TblMainAndPlaner". Please see the screenshot.
However, I have a question, how can I construct the code for the "re-open current Shift" button
so that the user, in the event of accidentally closing the form, could return to the record he worked on. The macro button must contain the code that will open the last record where (which I do not understand how to do) SiteID = 3. "SideID = 3" I gave as an example, all Id is 20. So depending on the copy, I can change siteID. I entered this Makro code, but unfortunately, it does not work:
buton-> event-> on click-> open form->(Form1) Where condition -> = DMax ("SiteID", "TblMainAndPlaner", "SiteID = 3").
Please can you help me with this, I'm completely stuck