sign-out end of day time date

T

tlvillareal

I have a database and how it works is that a person comes in and signs into
the database. Goes and does whatever they need to do in the building. Then
before they leave they sign out. Not multiple users using the database. It is
just a sign in/sign out database. So I have some users that come into the
building and sign in. Then when they leave they forget to sign out. I need a
sign out time so that I can calculate total hour a user was in the building.
So at the end of the day I need my signout field populated with a date time
stamp. So I don't really need to kick users out of any database. I just need
sort of If statement maybe that says if field is null at 4pm of the current
day the user signed in then insert date/timestamp. Anyone know how I can do
this?
 
G

Guest

You can use the On Timer event of a form to do this. Just set the timer
interval to an interval that will check as ofter an you would like and have
it check to see if the current time is equal to or greater than a specified
time. If it is then provide code that will be executed to run an update
query that will update all records in the table to "Now" where the log out
field is null.

Check the Access help file for the On Timer event and the Timer Interval
property.
 
T

tlvillareal via AccessMonster.com

Thanks Mr B!
What I ended up doing is:
I used the following update query:
UPDATE TBL_MAIN_VISITOR_VOLUNTEER AS T SET T.CHECK_OUT_DATE = T.CHECK_IN_DATE,
T.CHECK_OUT_TIME = '4:00:00 PM', T.TOTAL_TIME = [CHECK_OUT_TIME]-
[CHECK_IN_TIME]
WHERE (((IsNull([T].[CHECK_OUT_TIME]))<>False) AND ((DateDiff("d",[T].
[CHECK_IN_DATE],Now()))>0) AND ((T.CHECK_IN_DATE)<>Date()));

I then made an Open Query Macro to open the update query

In my main form when the database opens I set the on open event to run the
macro

I then suppressed the warning message so it automatically runs in the
background through Tools>Options>Edit/Find>confirm>uncheck action queries

So every morning when the database is opened it runs the update without
anyone knowing.

Thanks for all the help!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top