Results 1 to 6 of 6

Thread: SQL for a Number

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 1999
    Posts
    15

    Post

    How do I create SQL statement that lists all the records that selects the rightmost portion of a number in the listbox. For example, I have a few records for item number.

    40000
    50000
    52000
    55000
    60000

    I want to enter a number, 52000, in the textbox. This will select the righmost of 3 numbers of 52000. This will print 50000, 52000, and 55000 in the listbox. How do I do that? Thank you..

    Merry Christmas to you all...

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    What do you mean by "rightmost 3 numbers"? Do you mean the value above it and the value below it? Do you mean anything beginning with a 5?

  3. #3
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    So you want anything that begins with the same first digit AND has the same last 3 characters?

    Merry XMAS!

  4. #4

    Thread Starter
    New Member
    Join Date
    Aug 1999
    Posts
    15

    Post

    Yes, Clunietp!!!

  5. #5
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    SQL = "Select * from MyTable where MyDataField LIKE " & left(clng(text1.text), 1) & "*" & right(clng(text1.text), 3)

    HTH

    Tom

  6. #6

    Thread Starter
    New Member
    Join Date
    Aug 1999
    Posts
    15

    Post

    "rightmost 3 numbers" means the last 3 places of a number I enter. Yes, I want all records that start with the number "5" or any number. For instance, the statement is

    Right$(txtItemNumber.Text1, 3) = "000"

    It gets the rightmost 3 places (000) of that number. If I want to enter 50000 in the textbox, it prints 50000, 52000, 55000 in the listbox. How do I create an SQL statement...? I use DAO for working with the database. Thank you for responding .... Clunietp

    Have a Merry Christmas to you all!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width