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

A user clicks on a cmdButton with t

Status
Not open for further replies.

Conner

Technical User
Nov 29, 2000
44
0
0
US
A user clicks on a cmdButton with the click event set to store the date/time in a table "tblDateTime." The date and time are automatically entered with the Now() function. My problem is that later in the day, that same user can come back, click on the same cmdButton (Sign-In or Sign-Out), and automatically change the date/time in the field in the table that stored the original date/time.(It doesn't work to tell a group of teachers to be carefull choosing a sign-in button when you meant to choose sign-out, and so on.) I need a way to "stop" the process if someone tries to sign-out before they sign-in, or sign-in twice, or....and so on.

How do I check to see if a user has already signed in or out? What I think I'm trying to do is get to the Sign In and Sign out times stored in the table "tblDateTime" which has the field "SignIn" and "SignOut" on them.

I want the user to click on the cmdSignIn and proceed if there is not already a time entry in the appropriate field. My ultimate goal is to generate the following error messages:
"You have already signed-in on this date."
"You cannot sign-out before you sign-in"

and
"You are signing out for the day, but never signed in"

and so on...



 
Conner,

A possible solution would be to set up a sign in and sign out button.

When the user signs in the sign out is disable but once they sign in the sign out is enable but the sign out is disabled.


HTH,

Steve
 
One button could do the job:
Click 1: SignIn = Now
Click 2: SignOut = Now (later, of course)
Click 3: nothing happens...


Private Sub YourButton_Click()
If IsNull(Me.SignIn) Then
Me.SignIn = Now
ElseIf IsNull(Me.SignOut) Then
Me.SignOut = Now
End If
End Sub

HTH



[pipe]
Daniel Vlas
Systems Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top