Need help with Default "Date" value!

stew561

Registered User.
Local time
Today, 13:01
Joined
Sep 7, 2005
Messages
19
Say I have two date fields in my table:

[ApptDate]
[CallDate]


I want the default value for [CallDate] to be [ApptDate]+14 days.

How can I do this in a table?



Thanks For your help
 
In table design view, you can set default value to
Code:
=Date()+14

Edit= Realized I didn't read your post right first time.

This is better done in form. In the AfterUpdate event of Apptdate's textbox:

Code:
Me.txtCallDate = Me.ApptDate + 14
 
Last edited:
I want the data entry operator to be able to overide the default the[CallDate]


Would I still be able to do this in Form or should I do the formula in Table?
 
Yes, they can always override the default value, whether it's done in form or table.

I originally said table only because I thought you'd want it to be "7 days from today", but you wanted "7 days from this date", in which latter is best done on form and VBA as I gave above.
 
Banana said:
In table design view, you can set default value to
Code:
=Date()+14

Edit= Realized I didn't read your post right first time.

This is better done in form. In the AfterUpdate event of Apptdate's textbox:

Code:
Me.txtCallDate = Me.ApptDate + 14


I tried it, it dosen't seem to be working
 
I think what you're looking for is the DateAdd function

=DateAdd("d", 14, [ApptDate])

Set the CallDate to a date format. If you're using a form to enter or update your data, set the formula into CallDate on the form.
 
Sorry, I should warn you that you'll get an error in the CallDate on the form until you enter a date into ApptDate.
 
statsman said:
Sorry, I should warn you that you'll get an error in the CallDate on the form until you enter a date into ApptDate.



It still does not work. Should I post a sample of the Database?
 
Expressions are not bound. That's why the date is not being saved. Only controls whose ControlSource equals the name of a column from the form's RecordSource are bound. When the ControlSource starts with the equal sign, it is an expression and Access has no idea where you would want to save it.

Banana gave you the correct answer. Use the AfterUpdate event of the Apptdate control. Press the builder button to the right of the AfterUpdate property field. Choose the option to build code if that isn't the default. Add the 1 line into the procedure built by the builder.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom