Results 1 to 3 of 3
  1. #1
    geocan2006 is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    May 2016
    Posts
    34

    Trim after dashes

    I have a variable text string, I need to trim all the text after dash , presently my expression: Left([Model],InStr([Model],"-")-1) but it returns #Func! if doesn't find any



    Table1

    Model
    Red-1
    Red-2
    Red
    Yellow
    Yellow-2

    Want a query results like in below
    Query
    Red
    Red
    Red
    Yellow
    Yellow

    Thanks

  2. #2
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Use an IIf statement

    Code:
    IIf(Instr([Model],"-")>0,Left([Model],InStr([Model],"-")-1),[Model])
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  3. #3
    geocan2006 is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    May 2016
    Posts
    34
    Thanks,

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

Similar Threads

  1. query critera not accepting -- (two dashes)
    By tagteam in forum Access
    Replies: 3
    Last Post: 08-17-2016, 03:42 PM
  2. Dashes disappearing until mouseover
    By armyofdux in forum Import/Export Data
    Replies: 14
    Last Post: 02-05-2015, 10:25 AM
  3. Dashes in phone numbers and zip codes
    By JMack in forum Access
    Replies: 8
    Last Post: 11-18-2013, 01:56 PM
  4. How to Create a Autonumber with dashes
    By sylviar in forum Access
    Replies: 5
    Last Post: 05-09-2013, 09:08 AM
  5. Sorting by Letters and then numbers with dashes
    By Analogkid in forum Queries
    Replies: 8
    Last Post: 04-29-2013, 05:05 PM

Tags for this Thread

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