Question : VBA DCount problem

Hi EE
On a previous post i asked a question regarding DCount. which Capricorn1 answered for me.

Unfortunatly after using the solution on the second button on the form i came accross a small problem.
I have a button for breaks and also a button for Lunch on a form that a memeber of staff press. they are allowed to press the break button twice and the lunch button once each day.

The code Capricorn1 gave me to do this was:
If DCount("TimeLogedOut", "tblTimeSheet", "[DateToday] = #" & Date & "# And empID=" & [Forms]![frmGENSwitchboard]![EmpID]> 0 Then
  MsgBox "you have already taken your allocated break time"
  Exit Sub
End If

This worked great when i first used it on the Break Button, however when i then used it on the Lunch button it came up with the message on first press because the VBA requires one more filter

i have tried to re-write the code to include this extra filter but i cant get it working

can any one help

If DCount("TimeLogedOut", "tblTimeSheet", "[DateToday] = #" & Date & "# And empID=" & [Forms]![frmGENSwitchboard]![EmpID] And [CodeOUT] = "BREAK") > 0 Then
  MsgBox "you have already taken your allocated break time"
  Exit Sub
End If

as you can see from the code above the field i also need to filter for is CodeOUT and need to filter it to the fields that contain "BREAK"

The bit i added was at the end                  And [CodeOUT] = "BREAK"

What do i add to Capricorn1 Code at the very top in order to aditionaly filter for this?

Answer : VBA DCount problem

for i in `cat a.txt`
do
----
done
Random Solutions  
 
programming4us programming4us