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!

Adding the value from previous record as default value for next

Status
Not open for further replies.

Roz

Technical User
Feb 3, 2000
11
US
Is there a way to set a property for a date field on a form to have as a default the value entered in the date field on the previous record?
 
Good afternoon!<br><br>How about adding code to the AfterUpdate event to change the default value?<br><br>Private Sub YourFieldName_AfterUpdate()<br>&nbsp;&nbsp;&nbsp;&nbsp;Me!YourFieldName.DefaultValue = Me!YourFieldName<br>End Sub<br><br>I just tested it and it seems to work.&nbsp;&nbsp;Let me know.<br><br>Kathryn<br>
 
Roz<br><br>What about the DLAST() function?<br><br>Set the Default Value property to<br><br>Dlast(&quot;YourField&quot;, &quot;YourTable&quot;)
 
Thanks Kathryn.&nbsp;&nbsp;I tried the after update code and it worked.
 
Thanks Lightning.&nbsp;&nbsp;I tried the DLAST() and it works too.
 
I was interested in trying both of the methods suggested above. Here is what I found...<br><br>The DLast function worked just fine.<br><br>The Me!YourFieldName.DefaultValue=Me!YourFieldName yielded a date value of December 30, 1899. Did anybody else get this strange result?<br>Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top