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

Date updated problems 1

Status
Not open for further replies.

Dynapen

Programmer
Apr 20, 2000
245
US
I am building a database that tracks the movement of personnell records. If a record is checked out or not is displayed in a check box. The ID# for each personnel record is&nbsp;&nbsp;primary key so you don't have duplicate entries for each personnel record. I need to figure out how to set up a date field to show the last time the record was changed. Tried using a expression but that doesn't mean that i was doing it right. <br><br>example:<br><br>Record A is checked out to person B on 1/1/2000. When it comes back on 1/3/2000, and the box to show that it is checked out is changed, i need to date field &quot;Date Checked In/Out&quot; to update to the current date of 1/3/2000.<br><br>Thanks in advance<br><br>Dynapen
 
Assuming your checkbox and the date control are on the same form, put code like this into the checkbox's OnUpdateevent:<br>Me!DateCheckedInOut = Date()<br>
 
I put the code in to the AfterUpdate option (I am running Access 2K) and it asked for a Macro. So i changed it to expression like this:<br><br>[DateCheckedIn/Out]=Date(), and it didn't change anything. <br><br>What else can i try. Do i need to go with a Macro to do this?
 
Sorry about the event name being off. FYI, &quot;/&quot; is not a legal character for a field name. Better change the name of that control and any other that doesn't meet the standards (see Help, &quot;Guidelines for naming...&quot;). <br><br>No, you don't need a macro to do this. After inserting the code, click on Debug/Compile after inserting the code, and see if it compiles OK. If so, go back to your form in the regular form view and toggle the checkbox on or off. If you get an error message, let us know exactly what it says.
 
Select the control in question in design view, go to the property list of the control, select After Update event by clicking in the property. Click the Ellipsis (... 3 dots to the right), then select &quot;Code&quot;. Enter the line of code in the sub. When finished it should look like below:<br><br>Private Sub YourCheckbox_AfterUpdate()<br>Me![DateCheckedIn/Out] = Date<br>End Sub<br><br>&quot;YourCheckbox&quot; is for this example, it should be the actual name of your control.<br><br>HTH<br>RDH<br> <p>Ricky Hicks<br><a href=mailto: rdhicks@mindspring.com> rdhicks@mindspring.com</a><br><a href= > </a><br>
 
Thanks-<br><br>The Code that you submitted was perfect, it took care of the problem perfectly. Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top