last 6 of the vehicle VIN

G

Guest

Hi, all, I have a used car database, have about 2000 records, every vehicle
must have a VIN(Vehicle Identification Number), total should have 22
characters, i'd like to sep up search vehicle by the last 6 digits of the VIN
number, but sometimes the last 6 digits could also contains letters, how
would i do that, thank you.
 
R

Rick B

A VIN is normally 17 characters, not 22.

To pull the last six, create a new column in your query to display the last
six...

VIN6: Right([your field name],6)

Under that, you can put your criteria...

=[Enter VIN6 to locate]
 
R

Rick Brandt

Carol said:
Hi, all, I have a used car database, have about 2000 records, every
vehicle must have a VIN(Vehicle Identification Number), total should
have 22 characters, i'd like to sep up search vehicle by the last 6
digits of the VIN number, but sometimes the last 6 digits could also
contains letters, how would i do that, thank you.

Select *
From TableName
WHERE VIN LIKE '????????????????AAAAAA'

The string "AAAAAA" would be replaced with the six characters you are looking
for.

You could also use...

Select *
From TableName
WHERE Right(VIN, 6) = "AAAAAA"

I don't think either can use an index so the efficiency would be about the same.
 

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