Isolating Characters Left of Comma?

A

Anthony

I have a database where both Last Name and First Name are
combined in a single field. ie, Jones, Laura. For
comparison purposes I need to compare only the last name
within this field to another table.field that is only the
last name. Length of last name and position of comma vary
from record to record so MID and Left commands don't seem
to work.

Is there a command that will allow me to isolate only the
characters that exist left of the comma?
 
D

Dirk Goldgar

Anthony said:
I have a database where both Last Name and First Name are
combined in a single field. ie, Jones, Laura. For
comparison purposes I need to compare only the last name
within this field to another table.field that is only the
last name. Length of last name and position of comma vary
from record to record so MID and Left commands don't seem
to work.

Is there a command that will allow me to isolate only the
characters that exist left of the comma?

Use this expression:

Left([NameField], InStr([NameField], ",") - 1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top