Results 1 to 5 of 5
  1. #1
    webisti is offline The Wisher
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    115

    Update table via VBA

    Hi
    I am using this code to update a table but it does not work out, and can`t figure where I m doing the mistake:

    Code:
     ' add the first condtion - higher than 10k - to the table
                strSQL = "UPDATE Orders SET Orders.IC = ' Pls. contact Supervisor - Value over 10K USD' "
                strSQL = strSQL & "WHERE (((Orders.Value)>9999.00) AND ((Orders.PURCHASE_ORDER) Not Like ' 44* ' )); "
               CurrentDb.Execute (strSQL)
    Field Orders.Value is number ( fieldsize - double, format standart decimal places 2)



    any ideas
    Thanks

    Webisti

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Value is a bad name for a field because it is a reserved word. http://office.microsoft.com/en-us/ac...010030643.aspx

    Why doesn't it work - error message, wrong results, nothing happens?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    webisti is offline The Wisher
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    115
    Nothing happens and value is not the real word but I just renamed to have it easier to explain.

  4. #4
    webisti is offline The Wisher
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    115
    I tried to do it via a query:

    UPDATE Orders INNER JOIN O_OVER10K ON Orders.Purchase_order = O_OVER10K.Purchase_order SET Orders.IC = [O_OVER10K]![OVER10K];
    but it gives me an error message : operation must use an updateable query access.

    Any ideas?

    Webisti

  5. #5
    webisti is offline The Wisher
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    115
    I finally solved it by posting the results to a rtemp table then updating the main table.

    Thnx

    Webisti

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

Similar Threads

  1. Replies: 7
    Last Post: 09-21-2012, 11:09 AM
  2. Replies: 1
    Last Post: 02-08-2012, 04:50 PM
  3. Replies: 1
    Last Post: 01-22-2011, 12:23 PM
  4. Update field in table after update on a subform
    By jpkeller55 in forum Queries
    Replies: 3
    Last Post: 09-30-2010, 08:02 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