Truncate last name - then Use it for Parameter query!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a parameter query which in put name of a customer then it will display all information about this customer. However, this must be full name and usually user type it wrong.
Name field: Last name then a comma and then first name.
I want to truncate the last name only from name field. It separate from first name by a comma. Using this last name for parameter query. How can I do it?
Thanks in advance,
 
IIf(InStr(FullName, ",")>0, Left(FullName, InStr(FullName, ",")-1),
FullName)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Le Tran said:
Hi,
I have a parameter query which in put name of a customer then it will
display all information about this customer. However, this must be full name
and usually user type it wrong.
Name field: Last name then a comma and then first name.
I want to truncate the last name only from name field. It separate from
first name by a comma. Using this last name for parameter query. How can I
do it?
 
In a query, like this:

SELECT Left([Full Name], InStr([Full Name], ",") - 1) AS LastName
FROM MyTable;
 
Hi,

Where do I place this code in my parameter query? I did try many ways but it di not work.

Thanks,
 
Back
Top