Button On Form To Click To Change Other Field

X

Xtrapont

Hi,

I would like to have a button on a form that I can click
and it will change the contents of one field in the
current record showing in the form to the current date
and the contents of another field in the current record
showing in the form to todays date plus 14 days
 
W

Wayne Morgan

In the Click event of the button

Me.txtFirstTextbox = Date
Me.txtSecondTextbox = Date + 14

The reason just adding 14 works is because of the way VBA handles dates. The
date is stored as the number of days since a default date (Dec 30, 1899).
The decimal portion of the number is the time of day and the whole portion
of the number is the date.

Example:
1.25 would be Dec 31, 1899 6:00 AM
 

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