title: I am trying to lookup if a record already exist in a table
body: <p>I am trying to see if a record already exist for a patient's permanent address. I tried the folowing code but it's giving me error as Data type mismatch in criteria expression matched . The AddressType is a textbox and ClientCategory is a Number. I have put the code onload event of the mainform:   </p>
  
  <pre><code>If Not IsNull(DLookup("ID", "TableAddresses", "ID = '" &amp; Me.PatientID &amp; "' And AddressType = '" &amp; "Permanent" &amp; "' And ClientCategory = '" &amp; Me.ClientCategory &amp; "'")) Then
      Me!FrmClienPatientAddressViewsubform.Form!SameAsLocal.Value = True
  Else                 
      Me!FrmClienPatientAddressViewsubform.Form!SameAsLocal.Value = False
  End If
  </code></pre>