By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,656 Members | 920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,656 IT Pros & Developers. It's quick & easy.

Trouble updating a table using a calculated field via dateadd function...

P: 22
I am having problems trying to update a field in a database using a field in a form. I currently have two fields, Today and Tomorrow in a table named Date. The Today field automatically defaults to the current date, and what I am trying to accomplish is if this date changes, then the second field, Tomorrow, will automatically become equivalant to the value of Today +1. Sounds simple enough, however I cannot get the table to update. I am able to get the form to update by using a calculated field. I read that since this was a calculated field that it was not bound to the table and that I should use the after update field on the event tab in Today's properties to set the value of the field, Tomorrow. I also am trying to use the dateadd function in order to accomplish. I am using Access 2003 and so far I have not been successful in putting the correct syntax. I have surfed for a while now and so far I have not found anything that seems to work. Right now I only have one table with two fields to keep it simple.

1 table named Data containing two fields: Today and Tomorrow
Today = defaults to the current date
Tomorrow = value of Today + 1

If anyone has ideas of where I can find an example of syntax, i would appreciate it!!!!
Thanks!
Jul 11 '07 #1
Share this Question
Share on Google+
3 Replies


missinglinq
Expert 2.5K+
P: 3,532
Expand|Select|Wrap|Line Numbers
  1.  Private Sub Today_BeforeUpdate(Cancel As Integer)
  2.   Tomorrow = DateAdd("D", 1, Today)
  3. End Sub
  4.  
Good Luck!

Linq ;0)>
Jul 11 '07 #2

P: 22
Thank you so kindly. That definitely helped me get where I needed to go. Thanks again!
Jul 11 '07 #3

missinglinq
Expert 2.5K+
P: 3,532
Glad we could help!

Linq ;0)>
Jul 11 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.