Consecutive date in next record?

Fi_McC

New member
Local time
Today, 13:07
Joined
Mar 1, 2021
Messages
7
I am building a Tour Booking Form and am trying to set the default value in the 'TourDate' field. I would like it to be the next consecutive available date from my 'TourDate' field in a table called 'CompositeKeySchedule'. I have previously done this using a =DateAdd ("d","1",DMAX()) expression in the default value in the form but cannot for the life of me remember how I wrote the DMax expression. Can anyone help? It has worked previously but I am going round in circles here!
 
Could it have been something like?
Code:
DMax("DateField","TableName")
 
That is what I've been trying today, but it keep saying #Name? rather than inserting the next date. It is accepting the expression in the form properties but not returning the date. I have also had it saying #Type? when I tried a different selection of brackets....
 
That is what I've been trying today, but it keep saying #Name? rather than inserting the next date. It is accepting the expression in the form properties but not returning the date. I have also had it saying #Type? when I tried a different selection of brackets....
Okay, just a thought. Instead of entering it in the Table, try putting it on the Form.
 
Screenshot (4).pngScreenshot (5).pngScreenshot (6).png

Do you mean to try using the Form name instead of the table name in the DMax function? I've started again and made a new table, query and then form incase I had gotten my wires twisted. I've attached a screenshot of the Query, and then of the Form and the expression that I have used in the form to create a default 'next date'. As you can see it is just bringing up the #Name! issue rather than inserting a date. I would really appreciate any help. Think I'm going mad...
 
Hi. I think you may be getting the #Name? error because of syntax error in your DMax(). Maybe try this instead.
Code:
=DateAdd("d",1,DMax("TourDate","SampleTourQ"))
 
You are a modern day marvel. Works like a dream. Thank-you so much!
 

Users who are viewing this thread

Back
Top Bottom