1

I am trying to search the a table named "PeopleRecords" for a desk location given only the persons first name. Every time I attempt using a wild card I return "nope". How should I correctly use the wildcard?

param = Nz(DLookup("DeskLocation", "PeopleRecords", "[FullName] = '" & FirstName & "'"), "nope")
Adam
  • 13
  • 1
  • 3

1 Answers1

0
param = Nz(DLookup("DeskLocation", "PeopleRecords", "[FullName] LIKE '" & FirstName & "*'"), "nope")

Just edit the criteria to LIKE and add a wildcard (i.e. * for zero to x characters) after the name.

Jacob
  • 41,721
  • 6
  • 79
  • 81
  • It didn't work, but replacing the % with a * did. Thank you very much kind sir. – Adam Aug 02 '11 at 13:39
  • Ok, sorry. Using wildcards in Access is not as trivial as it seems ;) Editing the answer. – Jacob Aug 02 '11 at 13:40
  • Additionally, as an fyi to anyone who reads this in the future, if you test this line in the VBA debugger, don't forget to remove the extra quotes. – Adam Aug 02 '11 at 13:48