Results 1 to 3 of 3
  1. #1
    DaveT99 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Location
    SPAIN
    Posts
    94

    Insert (-) in a string

    This is really really bugging me, the update query works in a test database perfectly, i.e. inserts a dash after the 4th character, but as soon as a I paste the same criteria in my main database " "are added to the field name, see below



    I Have inserted both queries design view in a pdf, and repeated here,

    Left(New_MPN,4) & "-" & Mid(New_MPN,5) and in the main db when pasted to the upate query changes to Left("New_MPN",4) & "-" & Mid("New_MPN",5)

    Really appreciate if anyone can spot WHY

    Dave
    Attached Files Attached Files

  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
    Try enclosing New_MPN in square brackets.
    Make sure you remove the quotes in your update criteria.
    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
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    always put brackets around field to not confuse the query with litterals...

    Left([New_MPN],4) & "-" & Mid([New_MPN],5)

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

Similar Threads

  1. Replies: 2
    Last Post: 02-28-2017, 01:27 PM
  2. Replies: 1
    Last Post: 08-29-2016, 07:50 PM
  3. Error on INSERT INTO string built with VBA
    By sstiebinger in forum Queries
    Replies: 4
    Last Post: 11-30-2015, 03:07 PM
  4. Replies: 2
    Last Post: 04-05-2015, 06:06 PM
  5. Replies: 3
    Last Post: 01-05-2012, 10:47 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