Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto fill date filed in form

Status
Not open for further replies.

bradleyhorn

Technical User
Sep 15, 2004
35
US
Hi All,

I have a brain teaser. I ask the user fill in a date and then several fields in the form auto-fill with code similar to:

=[Forms]![SomeField]![Date1]+30

Since I have entered this code into the "Control source" property, it does enter the future date like I want it to, but doesn't write a date to the database when the form is saved. How would I get the date in the future to come up in the form field and also write it to the database? When I enter this code into the "initial value" property Access seems to ignore it.

Happy for any help,
Bradley
 
If I understand correctly, the field is unbound and not linked to a table but is a calculated field. If you want it in a table, in the underlying table create a date field and when the user enters the initial date, use the DateAdd() function to increment the 30 days and populate the new field.

I haven't failed, I have just found 10,000 ways that it won't work!
 
yeah,bound it back to the original field.And under the form "On current" event,typer the code (something like this) me.somefieldname.value=date+30.
 
Thanks for the help,

If I was to use the Date() function where would I insert the code? Into the Initial Value Property?

If I was to use "me.somefieldname.value=date+30", I assume that I would click the (...) next to "On Current" Event and create a sub program?

Bradley
 
Use the AfterUpdate event on the first field

I haven't failed, I have just found 10,000 ways that it won't work!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top