Override Default Date Value

Hey Lucy

Registered User.
Local time
Today, 03:29
Joined
Jan 20, 2012
Messages
124
I have searched through the forum but not yet found the answer I need for my issue. I'm sure there is something simple I'm missing here but....

I am developing a customers and orders database for a coffee sales company. I have, of course, a tblOrders that contains the fields 'OrderDate' and 'CallBackDate'. The 'CallBackDate', in most cases, should be 14 days from the 'OrderDate' and self-populate as a default value based on the 'OrderDate'. No problem with the concept there.

I originally wrote the following expression as the control source of the 'CallBackDate':

[OrderDate]+14

Yes, works beautifully, populates field just as it should. However, if, for some reason, they want the 'CallBackDate' to be more than 14 days, you can't override and type in your own date.

So, what is the way around this?

I have also tried making the control source the 'CallBackDate' field and the default value [OrderDate]+14, but then it doesn't default, only leaves the field open for manual entry.

I don't know VB, so I can't do it that way unless someone writes the code for me :-(. I know enough to insert already written code, but that's it. I need to be able to somehow do this within Access.

Text fields will allow you to override a default value.

Help/Suggestions are greatly appreciated!
 
There are two ways you can handle this.

1. A bit of vba code in your orderdate afterupdate event as follows:

CallBackDate=DateAdd("d",14,OrderDate)

this assumes that you have callback date as a field in your table, in which case the source for the callbackdate control should be the name of the callbackdate in your table (and not the calculation you have at present)

2. Alternatively if you don't want to use VBA you can handle this with a field in your table called CallBackDays with a default of 14 and your source for callbackdate becomes

=DateAdd("d",CallbackDays,OrderDate)

Then set the locked property for the field to true - the user then changes the CallBackDate by changing the value of CallBackDays
 
Thanks CJ & pbaldy for your responses! I used your second suggestion, CJ, and it works great
 

Users who are viewing this thread

Back
Top Bottom