S
serviceman via AccessMonster.com
Hi All!
I'm trying to create a time clock screen where a user can clock in and out.
What I would like to have happen is this: If a user goes to clock in, and
there is no record for this date, then show the TimeIn field. If there IS a
record, then show the TimeOut field. the screen has a combo box where the
user selectd their ID, and the after update event has the following code:
Dim db As Database
Dim rs As DAO.Recordset
Dim sSQL As String
sSQL = "SELECT * FROM TimeClock WHERE EMP_ID = " & Me.cboEmpl & "
AND WorkDate = #" & Me.WorkDate & "#"
'Check the database
Set db = CurrentDb
Set rs = db.OpenRecordset(sSQL, dbOpenSnapshot)
If Len(TimeOut) < 0 And Len(TimeIn) > 0 Then
Me.TimeIn.Visible = False
Me.TimeOut.Visible = True
Else
Me.TimeOut.Visible = False
Me.TimeIn.Visible = True
End If
rs.Close
Set rs = Nothing
Set db = Nothing
The problem is in the "If Len(TimeOut) < 0 And Len(TimeIn) > 0" portion; how
do I reference those fields in the recordset?
TIA,
Andy
I'm trying to create a time clock screen where a user can clock in and out.
What I would like to have happen is this: If a user goes to clock in, and
there is no record for this date, then show the TimeIn field. If there IS a
record, then show the TimeOut field. the screen has a combo box where the
user selectd their ID, and the after update event has the following code:
Dim db As Database
Dim rs As DAO.Recordset
Dim sSQL As String
sSQL = "SELECT * FROM TimeClock WHERE EMP_ID = " & Me.cboEmpl & "
AND WorkDate = #" & Me.WorkDate & "#"
'Check the database
Set db = CurrentDb
Set rs = db.OpenRecordset(sSQL, dbOpenSnapshot)
If Len(TimeOut) < 0 And Len(TimeIn) > 0 Then
Me.TimeIn.Visible = False
Me.TimeOut.Visible = True
Else
Me.TimeOut.Visible = False
Me.TimeIn.Visible = True
End If
rs.Close
Set rs = Nothing
Set db = Nothing
The problem is in the "If Len(TimeOut) < 0 And Len(TimeIn) > 0" portion; how
do I reference those fields in the recordset?
TIA,
Andy