Results 1 to 4 of 4
  1. #1
    aswin34 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Sep 2015
    Posts
    2

    Split alphanumeric field

    Hi


    I need to split alphanumeric field ( such as 567E, 567S) into 567 and E separately. But 567 should be text type. It had relationship with another table with the connected filed is of text type.

    I used val(Field) which gives numeric separately (567 with number data type). When I link this another table where 567 field is defined as text, which I cannot modify, getting error message "Data Type mismatch"

    Appreciate if somebody helps on this

    Thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    in your query have
    [code], val([code]) as CodeNum, , cStr(val([code])) as CodeStr

    to get the code, its num value, and its string value. Now you can join to whichever you need.

  3. #3
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    One way is to use the FORMAT function to coerce it back to text, i.e.
    Code:
    Format(Val([MyField]),"0")

  4. #4
    aswin34 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Sep 2015
    Posts
    2
    Hi ranman256 & JoeM

    It works fine. Thanks for your quick response and solution

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 02-10-2015, 02:12 PM
  2. Replies: 4
    Last Post: 02-06-2015, 03:58 AM
  3. Replies: 9
    Last Post: 11-14-2014, 06:11 PM
  4. Sorting by alphanumeric field
    By RonL in forum Access
    Replies: 1
    Last Post: 10-20-2012, 05:06 PM
  5. Format a field(AlphaNumeric)
    By Bakar in forum Database Design
    Replies: 1
    Last Post: 12-20-2010, 06:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums