Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2006
    Posts
    157

    Unanswered: Error during separate string

    HI:
    when i try to separate city, State and Zip, It separate all of them but in state it shows this in table.

    strCity= NORWALK
    strState= - -CT
    strZipCode=06854

    Doh="NORWALK CT, 06854"

    strCity= Left$(Doh,Instr(1,Doh,",")-4)
    strState= Mid$(Doh,Instr(1,Doh,",")-2,2)
    strZipCode= Right(Doh,Len(Doh)-Instr(1,Doh,",")-1)

    Thank you.

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    I don't understand the question.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Your code works fine in the Immediate Window, so your codes OK. Where are you actually doing this conversion? Also, look at your state field to see if you have an input mask or formatting set. I goota run but I'll check back in a while to see what your response is.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Jul 2006
    Posts
    157
    strState shows the hyphen during separation as i need only the state

    - -CT

  5. #5
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Someone on this site had a really neat routine to do this but I can't remember where it was.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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