Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    DaveT99 is offline Advanced Beginner
    Windows 11 Access 2019
    Join Date
    Mar 2018
    Location
    SPAIN
    Posts
    94


    Quote Originally Posted by Welshgasman View Post
    You have Left("L3",6)& "00
    You are using L3 as a literal, literally the word L3, not the field L3

    Look at my syntax. Replace YourField with L3. No quotes are required except for the 00
    Thanks again for your response

    Access is inserting the QUOTES after running the query

    Not sure what you mean "you are using L3 as a literal....."

    Have tried again Left(L3,6)& "00

    But same issue, am stumpt, obviously I am doing something wrong

  2. #17
    DaveT99 is offline Advanced Beginner
    Windows 11 Access 2019
    Join Date
    Mar 2018
    Location
    SPAIN
    Posts
    94
    Quote Originally Posted by Micron View Post
    Where? Maybe I could figure that out on my own but I'd rather not have to download, unzip and poke around in your file to try to figure that out.

    If it's an 8 digit field and you update digits 7 and 8 to 00 and then digits 5 and 6 to 00 then why not just change the last four to 0000 in either the new field or the existing one? Then it can just be myField = (myField\1000)*1000 as CJ indicated. NOTE: you must use \ and not /.

    Left() is a string function and I don't see that working if your field is actually numeric. I think that function can only return a string, so you will likely get a data type mismatch error if you try to use it.
    cant do that as the final output will be 3 columns

    e,g
    Col 1 Col 2 Col 3
    31401503 31401500 31400000

    Cheers
    Dave

  3. #18
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Just tested on a numeric field and no complaints.
    Code:
    UPDATE [old Transactions] SET [old Transactions].Amount = Left([amount],2) & "00";
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #19
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Have a look at the attached file please.
    Cheers,
    Attached Files Attached Files
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #20
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    What is the purpose of this?
    You can just take the first 4 characters and append "0000" to that.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  6. #21
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,820
    Hi Dave

    Look at query1 in the attached.

    I used CJ_London's example
    Attached Files Attached Files

  7. #22
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    from your pdf.

    1. it looks like this is a text field since the values are orientated to the left - so my method is unlikely to work
    2. when using the query builder, you need to use square brackets i.e. [L3] to indicate it is a field and not literal text

    so this
    Left(L3,6)& "00

    becomes this

    Left([L3],6)& "00"

    Not sure what you mean "you are using L3 as a literal....."
    hope that is now clear

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 07-17-2022, 08:48 AM
  2. Replies: 4
    Last Post: 02-01-2019, 12:41 AM
  3. Replies: 2
    Last Post: 08-16-2018, 06:56 AM
  4. Character Replacement by Position in String
    By J Bhujanga in forum Queries
    Replies: 5
    Last Post: 07-08-2017, 05:16 PM
  5. Replies: 5
    Last Post: 08-25-2014, 05:33 PM

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