On Updated (of Date/Time picker)...

S

SF

Hi,

I have a simple data entry form consist of 3 fields:
dtStartDate (using Data/Time picker)
text box that store number of Day (txtDays)
and dtEndDate

Normally the txtDays is defaulted to carry 1. I want to automatically fill
the dtEndDate (normally is dtStartDate + txtDays) based on the date
selection from the datetime picker. I use On_Updated event of DateTimepicker
but this event does not appear to be working.

Could someone suggest.

SF
 
D

dcichelli

Hi,

I have a simple data entry form consist of 3 fields:
dtStartDate (using Data/Time picker)
text box that store number of Day (txtDays)
and dtEndDate

Normally the txtDays is defaulted to carry 1. I want to automatically fill
the dtEndDate (normally is dtStartDate + txtDays) based on the date
selection from the datetime picker. I use On_Updated event of DateTimepicker
but this event does not appear to be working.

Could someone suggest.

SF

Hi SF,

I think I can help you out....

*********First problem - the field txtDays in the form and underlying
table needs to be a number field - you MUST correct this
first******************


Ok go to the design view of your form and right click the top left box
to open the properties of the entire form

Under the event tab of the properties window click on the "On Current"
field

Click the "..." box next to the field

Select "Macro Builder" from the drop-down menu

Name your new macro whatever like "AddDate"

Under the first row action column select "Set Value"

At the bottom of the macro window under the "Item" field indicate the
field name of the dtEndDate field (e.g. Forms![DataEntry]![dtEndDate])

Under the "Expression" field type: DateAdd("d",[Forms]![DataEntry]!
[txtDays],[Forms]![DataEntry]![dtStartDate])



Now when you update your form, the dtEndDate will calculate to the new
date. This will not be visible when you enter the new data, only when
you move away from the current record and go back (or open and close
the form).

Sound good?

Diane
 
G

Guest

Hi SF,

I think you will be a lot happier to use a text box on your form that is
bound to dtStartDate, in conjunction with a form based calendar that is not
an ActiveX control. Here is a good one (there are several others as well):

Popup Calendar
http://allenbrowne.com/ser-51.html

You can then use the After_Update event procedure of the text box bound to
your date field to run your desired code.


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
 

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