locked
Job ID: Mid([Job ID FR Seq],1,find("-",[Job ID FR Seq])-1) RRS feed

  • Question

  • In a query, I need a mid statement to get all digits prior to the hyphen.

    This did not work for me:

    Job ID: Mid([Job ID FR Seq],1,find("-",[Job ID FR Seq])-1)

    Monday, March 24, 2014 2:27 PM

Answers

  • You need InStr function in Access,

    Job ID: Mid([Job ID FR Seq], 1, InStr([Job ID FR Seq], "-")-1)

    You can also use Left function,

    ? Left("PAUL-1235896", InStr("PAUL-1235896", "-")-1)
    PAUL


    Happy to help ! When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answered


    Monday, March 24, 2014 2:41 PM

All replies

  • You need InStr function in Access,

    Job ID: Mid([Job ID FR Seq], 1, InStr([Job ID FR Seq], "-")-1)

    You can also use Left function,

    ? Left("PAUL-1235896", InStr("PAUL-1235896", "-")-1)
    PAUL


    Happy to help ! When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answered


    Monday, March 24, 2014 2:41 PM
  • Perfect, thank you!

    Job ID: Trim(Left([Job ID FR Seq],InStr([Job ID FR Seq],"-")-1))*1

    Monday, March 24, 2014 2:49 PM
  • No problem ! Good Luck :)

    Happy to help ! When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answered

    Monday, March 24, 2014 2:50 PM