Results 1 to 5 of 5

Thread: Selecting Certain Letters From a Table In Access

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2003
    Posts
    27

    Selecting Certain Letters From a Table In Access

    Hi!
    I am using access and my table has a set of data that is in the format 12-34-56 and I have a form which looks this information up. I was wondering if it were possible to have one field on a form that will display the first two numbers (12) and then in a second field display the rest of the numbers but remove the hyphen, all while keeping the data the same on the table. So the back end remains 12-34-56 but the first field displays 12 and the second field displays 3456

    any ideas?!

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Posts
    424
    just use left$ and mid$ respectively.

  3. #3
    Addicted Member
    Join Date
    Aug 2003
    Location
    Singapore
    Posts
    245

    Lightbulb Just Replace & Mid$

    May be this helps...
    VB Code:
    1. TheData = "12-34-56"
    2. TheData = Replace(TheData, "-", "", 1, , vbTextCompare)
    3. Text1.Text = Mid$(TheData, 1, 2) ' 12
    4. Text2.Text = Mid$(TheData, 3)      ' 3456
    I may have interpret your post wrongly
    Correct me if I made a mistake...
    Hope This Helps.. .....Enjoy Coding.....//


    zak2zak

  4. #4
    Hyperactive Member
    Join Date
    Mar 2002
    Posts
    424
    Word of caution.. if you're not using Access 2000 and above the Replace function will not be available to you.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jul 2003
    Posts
    27
    This was my solution, in the control source...

    Code:
    =Replace(Right$(sfrmOHMAll.Form!ATA,Len(sfrmOHMAll.Form!ATA)-3),'-','')
    thanks 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