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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

frmAutoDate Field

Status
Not open for further replies.

detgharris

Technical User
Jun 29, 2009
10
US
Ok, another simple question that seems to keep eluding me, I've searched all the FAQ's and looked in the forums, but still puzzled. I have a table where the primary key is the date, only one date per record, no duplicates. I want the table to automatically go to the following date. Example, record #1 is 08/10/2009 I want the next record to automatically have 08/11/2009 then 08/12/2009. What am I missing??
 
detgharris said:
I want the table to automatically go to the following date
You can't do this in a table. You could use the after update event of a form to set the default value of a control to the maximum date + 1. Our perhaps you can set the default to the current date.

Duane
Hook'D on Access
MS Access MVP
 
Ok, in the form, instead of the table, I could set the default value to maximum +1??
 
The "maximum+1" technique fails as soom as you have more than one user. One person gets the max+1 but before they can hit save and update the record another user comes in and gets the same max+1.

It's better to have a separate table holding the last date used. You can then lock this whilst a user in in the process of updating so that no other user can get the same value.

Geoff Franklin
 
That answered it, thanks so much, I knew it was something really simple that I wasn't getting. I was trying to find all kinds of VBA code for the solution, you made my day. Thanks again....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top