Link to home
Start Free TrialLog in
Avatar of mickeyshelley1
mickeyshelley1Flag for United States of America

asked on

Modify DLook Function

In the code below the DLookup function is searching a query named RevokedLicense. This column in this query that is to be searched is named CompleteName. It is looking for a name that matches the name that has been entered into a textbox that is also named CompleteName. The problem is it needs to be able to locate either John Doe or John W Doe and currently the name has to be exact. Can the code be modified to accommodate this.
Private Sub Command175_Click()
If IsNull(DLookup("[CompleteName]", "RevokedLicense", "[CompleteName]='" & Me![CompleteName] & "'")) = False Then
Me.Label177.Caption = "REVOKED"
Else
Me.Label177.Caption = ""
 
 
 
End Sub

Open in new window

Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image


try this:

If IsNull(DLookup("[CompleteName]", "RevokedLicense", "[CompleteName] like " & Chr(34)  & Me![CompleteName] & Chr(34) & "*")) = False Then

is the table wher you derived the query RevokedLicense also show the CompleteName and not broken to FirstName | LastName | MI  ?
Avatar of mickeyshelley1

ASKER

Both show complete name
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America 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
Thanks Again
Chief,
you may also use a combo box to select the name.
you can include the completeName and other fields that will make an entry unique from the other records.