I have some VB code that looks at a couple of different text boxes on a form and performs a search using that box if there is a value:
This search works great provided that the NPI value that is entered can be matched by the Dlookup. However, if the NPI is not found there isn't a good indicator to the user that something is awry. I've tried looking for a solution but everything I can find is not quite what I need. Really all I need is a message box to pop up and let them know the NPI wasn't found. Can I add that without performing the Dlookup twice?
Code:
If (Not IsNull(Me![srchNPI])) Then
NPISearch = Nz(DLookup("PRESBR_ID", "TBL_PRESBR_NPI", "PRESBR_NPI = '" & Forms!frmMain!srchNPI & "'"), 0)
Me![IngenixID] = NPISearch
Me!frmNameSub.Requery
Me!frmAddressSub.Requery
Me!frmSancSub.Requery
Me!frmPhoneSub.Requery
Exit Sub
End If
This search works great provided that the NPI value that is entered can be matched by the Dlookup. However, if the NPI is not found there isn't a good indicator to the user that something is awry. I've tried looking for a solution but everything I can find is not quite what I need. Really all I need is a message box to pop up and let them know the NPI wasn't found. Can I add that without performing the Dlookup twice?