HOW DO I USE A TIMER IN ACCESS?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using access 2000 and trying to create a database to record and track
time spent on jobs to eventually use in payroll.
I have 2 command buttons in the form - one for logon, the other logoff.
I need to be able to record the time on and off when these buttons are
clicked by the employee but am not sure how to do it as I am really only a
beginner with some parts of access
 
I am using access 2000 and trying to create a database to record and track
time spent on jobs to eventually use in payroll.
I have 2 command buttons in the form - one for logon, the other logoff.
I need to be able to record the time on and off when these buttons are
clicked by the employee but am not sure how to do it as I am really only a
beginner with some parts of access

Add a table with 3 fields to the database.
LogID AutoNumber, Indexed No duplicates, Prime Key
TimeLogOn .. DateTime datatype
TimeLogOff .. DateTime datetype
Name the table tblLogTimes

Set the format property of each to
General Date

Add a Command Button to the form.
Name it cmdLogOn
Set it's Caption to "Log On"

Add another Command Button to the form.
Name it cmdLogOff
Set it's Caption to "Log Off"
Make this button Not Visible.

Open the Form's Code window (click View + Code).
Up in the Code's Declaration section, write:
Option Explicit
Dim dteLogOn as Date
===========

Code the cmdLogOn command button click event:

dteLogOn = Now
cmdLogOff.Visible = True
[AControl].SetFocus
cmdLogOn.Visible = False

Code the cmdLogOff Command Button click event:

Dim strSQL As String
strSQL = "Insert into tblLogTimes (TimeLogOn, TimeLogOff) Values (#" &
dteLogOn & "#, #" & Now & "#);"
CurrentDb.Execute strSQL, dbFailOnError
CmdLogOn.Visible = True
[AControl].SetFocus
CmdLogOff.Visible = False

Note: Change [AControl] to whatever the name is of the next control
you wish to go to.

When opened, only the Log On button is visible. When it is clicked, it
becomes not visible and the Log Off button is visible.
 
I must be having a bad week - thebrain definately not working.
Can you explain to me in normal english the control - assuming it is the
next page ie switchboard??

fredg said:
I am using access 2000 and trying to create a database to record and track
time spent on jobs to eventually use in payroll.
I have 2 command buttons in the form - one for logon, the other logoff.
I need to be able to record the time on and off when these buttons are
clicked by the employee but am not sure how to do it as I am really only a
beginner with some parts of access

Add a table with 3 fields to the database.
LogID AutoNumber, Indexed No duplicates, Prime Key
TimeLogOn .. DateTime datatype
TimeLogOff .. DateTime datetype
Name the table tblLogTimes

Set the format property of each to
General Date

Add a Command Button to the form.
Name it cmdLogOn
Set it's Caption to "Log On"

Add another Command Button to the form.
Name it cmdLogOff
Set it's Caption to "Log Off"
Make this button Not Visible.

Open the Form's Code window (click View + Code).
Up in the Code's Declaration section, write:
Option Explicit
Dim dteLogOn as Date
===========

Code the cmdLogOn command button click event:

dteLogOn = Now
cmdLogOff.Visible = True
[AControl].SetFocus
cmdLogOn.Visible = False

Code the cmdLogOff Command Button click event:

Dim strSQL As String
strSQL = "Insert into tblLogTimes (TimeLogOn, TimeLogOff) Values (#" &
dteLogOn & "#, #" & Now & "#);"
CurrentDb.Execute strSQL, dbFailOnError
CmdLogOn.Visible = True
[AControl].SetFocus
CmdLogOff.Visible = False

Note: Change [AControl] to whatever the name is of the next control
you wish to go to.

When opened, only the Log On button is visible. When it is clicked, it
becomes not visible and the Log Off button is visible.

Michelle,
I guess my brain is not working either.
What do you mean by this sentence:
"Can you explain to me in normal english the control - assuming it is
the next page ie switchboard??"

Remember... you know what you are talking about. You have to do a bit
more to explain what you want so others will understand you.
 
Back
Top