You need to remove Me.EmployeeID from the quotes, so that you have a value being
put into the criteria string.
Select Case DLookup("[Status]", "Employee Main", _
"[Employee ID] =" & Me.EmployeeID)
Case "Part Time"
Response = MsgBox(Msg1, Style, Title)
Case "Casual"
Response = MsgBox(Msg2, Style, Title)
End Select
AngiW wrote:
>
> John,
> Thank you for that...I forgot how to do cases. But it's not working. It lets
> me add the record even if they're part time and a message box never comes up.
> EmployeeID is a number field. Primary key for Employee table is Employee ID.
> Foreign key is EmployeeID. Does the fact that I'm using a lookup on the
> foreign key to display their name (last name + first name) instead of their
> number change anything? I looked and it's storing their name instead of their
> number in the table, which is what I didn't want, but that's what it's doing.
> I have the bound column set to the number, not the name. Here's what I now
> have. What am I doing wrong?? So much for me thinking this was easy!
>
> Select Case DLookup("[Status]", "Employee Main", _
> "[Employee ID] = Me.EmployeeID")
> Case "Part Time"
> Response = MsgBox(Msg1, Style, Title)
> Case "Casual"
> Response = MsgBox(Msg2, Style, Title)
> End Select
|