How do I set up or validate cardinalities, such as (0,5), in MS A.

G

Guest

I am trying to set up a validation that will make sure that a particular
employee has no more than five patients personally assigned to them. I have
a patient table with the employee Id set as a field. I have been trying to
write an expression in Visual Basic, but I have not yet gotten it to work. I
think that I am using the DCount function wrong. Any help with that would be
greatly appreciated. All fields involved are CHAR(5). I wonder if this type
of cardinality is even possible with MS Acess.
 
G

Guest

Try

If DCount("*","TableName","[Employee Id] = " & EmployeeId) > 5 Then
Msgbox "More then 5"
End If

If the employee id is text, try
DCount("*","TableName","[Employee Id] = '" & EmployeeId & "'")

Note:
[Employee Id] - the name of the field in the table
EmployeeId - the name of the variable
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top