P
poorboy13 via AccessMonster.com
Hello,
I'm hoping this should be easy - I just can't seem to find the answer. I'm
guessing my syntax is wrong but I can not figure it out.
I am making a Db for work to keep track of Tasks and Performance.
The 2 main functions I am trying to keep track of is total hours signed in
and how long it takes to complete each of the tasks assigned to the Employee.
I'm trying to put a small check in it that an employee can not begin a task
without being signed in for the day. This is being tracked on 2 different
tables. (Attendance.tbl and Times.tbl)
So in the form to begin the task when you click on the command button I want
it to run a query, in the background, of the attendance table to see if the
employee is present (Yes/No Check Box).
If No it will bring up a MsgBox to tell him he has not signed in yet and then
cancel the operation and not put anything in the Times table.
If yes then it will go through and complete the form with the date and time
it was started.
I have it so that it runs the query, not in the back ground but at least it
runs,
The Problem is regardless of whether the employee is signed in or not I still
get the message that he is not signed in.
Here is the code so far:
Private Sub Command14_Click()
DoCmd.OpenQuery ("qry_GetWork")
If Present = 0 Then
MsgBox "Please Sign in to begin working!", vbOKOnly, "Can Not Continue"
DoCmd.Close 'To Close the Query Window
DoCmd.Close 'To Close the Form
Else
StartDate.Locked = False
StartTime.Locked = False
StartDate = Date
StartTime = Now()
StartTime.Locked = True
StartDate.Locked = True
DoCmd.Close 'Close Form
End If
End Sub
I can live with the query window showing if the thing would get the right
answer.
Or maybe there is a completely different way I should attack it????
Thanks, in Advance!
I'm hoping this should be easy - I just can't seem to find the answer. I'm
guessing my syntax is wrong but I can not figure it out.
I am making a Db for work to keep track of Tasks and Performance.
The 2 main functions I am trying to keep track of is total hours signed in
and how long it takes to complete each of the tasks assigned to the Employee.
I'm trying to put a small check in it that an employee can not begin a task
without being signed in for the day. This is being tracked on 2 different
tables. (Attendance.tbl and Times.tbl)
So in the form to begin the task when you click on the command button I want
it to run a query, in the background, of the attendance table to see if the
employee is present (Yes/No Check Box).
If No it will bring up a MsgBox to tell him he has not signed in yet and then
cancel the operation and not put anything in the Times table.
If yes then it will go through and complete the form with the date and time
it was started.
I have it so that it runs the query, not in the back ground but at least it
runs,
The Problem is regardless of whether the employee is signed in or not I still
get the message that he is not signed in.
Here is the code so far:
Private Sub Command14_Click()
DoCmd.OpenQuery ("qry_GetWork")
If Present = 0 Then
MsgBox "Please Sign in to begin working!", vbOKOnly, "Can Not Continue"
DoCmd.Close 'To Close the Query Window
DoCmd.Close 'To Close the Form
Else
StartDate.Locked = False
StartTime.Locked = False
StartDate = Date
StartTime = Now()
StartTime.Locked = True
StartDate.Locked = True
DoCmd.Close 'Close Form
End If
End Sub
I can live with the query window showing if the thing would get the right
answer.
Or maybe there is a completely different way I should attack it????
Thanks, in Advance!