Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

Checkbox true if criteria exists

I have a checkbox on a form named chkbxCurrentCustomer.

I need code in the oncurrent event of the form to check the checkbox true if the contents of the field "FullName" exists in a field named "FullName" in tblCustomers.

Otherwise it should be false.

How can I do this?
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
So your form is not the based on tblCustomers, is that correct?

You could use something like:

Private Sub Form_Current:

  if me.[FullName] & "" = "" Then
      me.chkbxCurrentCustomer = false
  elseif DCOUNT("*", "tblCustomers", "[FullName] = '" & me.[FullName] & "'") > 0 Then
      me.chkbxCurrentCustomer = true
  Else
       me.chkbxCurrentCustomer = false
   End If

End Sub