Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Multiuser / Networking / January 2006

Tip: Looking for answers? Try searching our database.

Creating & Editing a Log File

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jhrBanker - 12 Jan 2006 16:42 GMT
I have a Table bound to my Main form that opens automatically (autoexec).
The table contains an Auto field, UserID, Date/Time In & Date/Time out fields.
When the user opens the database the Main form opens and a record is created
with the Auto field(Key), UserID and Date/Time In.  When the user closes the
Main form to exit the application, I want to find the record and edit it to
include the Date/Time Out.  I'm able to create the initial record, but
nothing I've tried will add the Date/Time Out when the user exits.  I can't
even determine how to locate the record, since the Key field is an Auto
field.  The only other way I can figure to identify the initial record is by
a combination of UserID & Date/Time In.  But all the search methods I've
found seem to work with only one field.  Does anyone have any sample code
that fits my criteria?
Thanks,
JR
tina - 13 Jan 2006 03:35 GMT
if the table is bound to the Main form, the record you create when the form
opens should remain the Current record in the form - unless you close the
form or specifically move to another record. since the user closes the same
form, to exit the db, you should be able to simply add the Date/Time Out to
the current record. what happens when you try to do that?

hth

> I have a Table bound to my Main form that opens automatically (autoexec).
> The table contains an Auto field, UserID, Date/Time In & Date/Time out fields.
[quoted text clipped - 10 lines]
> Thanks,
> JR
George Nicholson - 13 Jan 2006 18:23 GMT
As an update query, using a subquery to select the record to update:

strUserID = "CurrentUserID"

strSQL = "UPDATE UsageLog SET DateTimeOut = Now() "
strSQL = strSQL & "WHERE (((UsageLog.UserID)='" & strUserID & "') "
strSQL = strSQL & "AND ((UsageLog.DateTimeIn)= "
strSQL = strSQL & "(SELECT Max(UsageLog.DateTimeIn) FROM UsageLog WHERE
UserID = '" & strUserID & "')));"

CurrentDB.Execute strSQL, dbFailOnError

The subquery:
       "(SELECT Max(UsageLog.DateTimeIn) FROM UsageLog WHERE UserID = '" &
strUserID & "')"
Gets the Current User's most recent LogIn time. That value is then used as
the criteria for the record to be updated. UserID is used as a 2nd criteria,
just in case multiple users have the same login time.

HTH,
Signature

George Nicholson

Remove 'Junk' from return address.

>I have a Table bound to my Main form that opens automatically (autoexec).
> The table contains an Auto field, UserID, Date/Time In & Date/Time out
[quoted text clipped - 16 lines]
> Thanks,
> JR
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.