Problem selecting from database using partial string

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wlupton
    New Member
    • Nov 2006
    • 1

    #1

    Problem selecting from database using partial string

    Hi All;

    My problem is getting information from an Access database using a partial string in VB6.

    The database consists of tables of information on motor vehicles including a 17 character VIN number.

    To make life easier I wish to select data from the table using the last eight (rightmost) characters of the string. I have used the following select satement.

    SELECT table.[year],table.[make],table.[model] .......etc from table WHERE table.[Right(vin,8)] = """& txtbox & """

    When I run this the program comes to a grinding halt without an error message.

    If I run the program using a full VIN number (without the right(s,8)) it runs without a hitch.

    Anybody got an idea what I'm doing wrong?

    Thanks
  • scripto
    New Member
    • Oct 2006
    • 143

    #2
    Originally posted by wlupton
    Hi All;


    SELECT table.[year],table.[make],table.[model] .......etc from table WHERE table.[Right(vin,8)] = """& txtbox & """

    try this:

    SELECT table.[year],table.[make],table.[model] .......etc from table WHERE table.vin like "*" & txtbox.text

    Comment

    Working...