Editing a particular record in a table

Henley12

Troy University Fan
Local time
Today, 13:24
Joined
Oct 10, 2007
Messages
222
I know this should be simple, but I have a table of database users and I want to save the last login date and time every time they log in. I know I can edit the table with the .Edit and so forth, but how do I position the pointer to the proper record so it won't just write to the first record every time?
 
What I do is have a hidden form, which is bound to the table. It is set to DataEntry, so it goes to a new record when they log in. Then in the On Load event I set the values for the date/time and the user. Then, I also include a Save of the record.

Then in that form's UNLOAD event, I put the other code to set the log out field date/time stamp. The record hasn't moved so I don't need to worry where it puts it. If they close the database with the X on the application window, it logs the out. The only way it wouldn't is if it was Ctrl+Alt+Del but then when opening the form in Data Entry mode it will always go to a new record on the open of the form.
 
Well, I'm probably doing something wrong, but that adds another entry to the table. What I want is to edit an existing record with the login information.
 
Well, I'm probably doing something wrong, but that adds another entry to the table. What I want is to edit an existing record with the login information.

Oh, I missed that. I always saved the entire log, not just the last time they logged in (I could get that with a MAX function in a query).

You would need to do a FindRecord in the form's On Load event to find the appropriate employeeID. And then modify the record.
 
I believe I have figured it out. Thanks for all your insight.
 
I believe I have figured it out.
Glad to hear


yeahsmile.jpg
 

Users who are viewing this thread

Back
Top Bottom