use count query result in an IF statement

M

michael goodall

can anyone send me the code to use the result of a count query in an
IF statement. i basically want it to be like IF count result = 1 THEN
open form swimmers ELSE open form error. many thanks michael
 
O

Ofer Cohen

Try

If Nz(DlookUp("FieldName","QueryName"),0)=1 Then
Docmd.OpenForm "swimmers"
Else
Docmd.OpenForm "ErrorForm"
End If
 
Top