Making another fields date value a Default value plus 17 days

R

Rich

I am hopelessly trying to figure this out. Basically I have a "To
Contractor" field and a "Contractor Suspense" field within a 2007 Acess
database table. Both are date fields. I want the "Contractor Suspense"
field to equal the "To Contractor" plus 17 days (this is their suspense). I
was trying to work with the default value within the table design for the
"Contractor Suspense field". No luck. The best I could come up with is to
add Date( ) + 17 as a default value to get me close. However, the current
date and the "To Contractor" date may be days apart. Seems pretty
easy...But, I have basic computer skills. Open to suggestions.
 
J

John W. Vinson

I am hopelessly trying to figure this out. Basically I have a "To
Contractor" field and a "Contractor Suspense" field within a 2007 Acess
database table. Both are date fields. I want the "Contractor Suspense"
field to equal the "To Contractor" plus 17 days (this is their suspense). I
was trying to work with the default value within the table design for the
"Contractor Suspense field". No luck. The best I could come up with is to
add Date( ) + 17 as a default value to get me close. However, the current
date and the "To Contractor" date may be days apart. Seems pretty
easy...But, I have basic computer skills. Open to suggestions.

If the suspense date is *always* 17 days after the To Contractor date, then it
should *simply not exist* in your table. Instead, calculate it "on the fly" in
a query; in a vacant Field cell in the query, type

SuspenseDate: DateAdd("d", 17, [To Contractor])

(note: if you're editing or viewing data directly in a table, Don't. That's
not the function of tables and they're not good at it).

If the suspense date is just a default which may be edited (e.g. if the To
Contractor date is December 8 and you know that you're not going to insist on
Suspense on Christmas Day), you'll need to use just a little bit of VBA code
or a Macro on your data entry form to "push" the same expression into the
suspense date field. Use the AfterUpdate event of the To Contractor control.
 
S

Stockwell43

Hi Rich,

I would use a separate textbox and the control source put:
=[ToContractor]+17

OR

If you are saving it to your table use VBA and in the After Update of the
ToContractor textbox use:
Me.ContractorSuspense=[ToContractor]+17

OR

Just calculate it in the query. I guess it depends on how you are using it.

Hope this helps!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top