Results 1 to 4 of 4
  1. #1
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727

    action queries together

    can I use a update statement and append statement in the same query?
    Code:
    UPDATE SMALLPKG SET SMALLPKG.[Recipient Company] = "ATLAS COPCO COMPRESSORS"
    WHERE (((SMALLPKG.[Recipient Company])="ATLAS COPCO (ORIGIN AIR)")) OR (((SMALLPKG.[Recipient Company])="NORTH AMERICAN SERVICE CENTER")) OR (((SMALLPKG.[Recipient Company])="ATLAS COPCO ASAP")) OR (((SMALLPKG.[Recipient Company])="ATLAS COPCO COMPRESSORS LLC")) OR (((SMALLPKG.[Recipient Company])="ATLAS COPCO COMPRESSORS, LLC"))
    UPDATE SMALLPKG SET SMALLPKG.[Shipper Company] = "ATLAS COPCO COMPRESSORS"
    WHERE (((SMALLPKG.[Shipper Company])="ATLAS COPCO (ORIGIN AIR)")) OR (((SMALLPKG.[Shipper Company])="NORTH AMERICAN SERVICE CENTER")) OR (((SMALLPKG.[Shipper Company])="ATLAS COPCO ASAP")) OR (((SMALLPKG.[Shipper Company])="ATLAS COPCO COMPRESSORS LLC")) OR (((SMALLPKG.[Shipper Company])="ATLAS COPCO COMPRESSORS, LLC"))
    
    INSERT INTO tblSP_SHIPMENT_temp_TEST ( INVOICENUM, TRACKINGNUM, SHIPDATE, TRANSCHG, SALESORDNUM, SENDERNAME, SENDERCITY, SENDERSTATE, SENDERZIP, RECIPIENTNAME, RECIPIENTCITY, RECIPIENTSTATE, RECIPIENTZIP, WEIGHT, SERVICETYPE )
    SELECT SMALLPKG.[Invoice Number], SMALLPKG.[Express or Ground Tracking ID], SMALLPKG.[Shipment Date], SMALLPKG.[Net Charge Amount], SMALLPKG.[Original Customer Reference], SMALLPKG.[Shipper Company], SMALLPKG.[Shipper City], SMALLPKG.[Shipper State], SMALLPKG.[Shipper Zip Code], SMALLPKG.[Recipient Company], SMALLPKG.[Recipient City], SMALLPKG.[Recipient State], SMALLPKG.[Recipient Zip Code], SMALLPKG.[Actual Weight Amount], SMALLPKG.[Service Type]
    FROM SMALLPKG;
    If yes; what am I missing here?


    Thanks

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    AFAIK, Access allows only one 'verb' (Select/Insert/Update) per query.

    Since the two Update queries are on the same table, you can combine them:
    Code:
    UPDATE SMALLPKG SET SMALLPKG.[Recipient Company] = "ATLAS COPCO COMPRESSORS", SMALLPKG.[Shipper Company] = "ATLAS COPCO COMPRESSORS"
    WHERE (((SMALLPKG.[Recipient Company])="ATLAS COPCO (ORIGIN AIR)")) OR (((SMALLPKG.[Recipient Company])="NORTH AMERICAN SERVICE CENTER")) OR (((SMALLPKG.[Recipient Company])="ATLAS COPCO ASAP")) OR (((SMALLPKG.[Recipient Company])="ATLAS COPCO COMPRESSORS LLC")) OR (((SMALLPKG.[Recipient Company])="ATLAS COPCO COMPRESSORS, LLC"))


    Observation......
    I don't know your requirements, but you might look at having a Companies table and store the CompanyPK in a FK field for "Recipient Company and "Shipper Company", instead of storing the name of the companies. Using a combo box to select the company name ensures a consistent name.

  3. #3
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    do I put this before or after the append query?

  4. #4
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by slimjen View Post
    do I put this before or after the append query?
    You have two queries: an Update query and an Append query. You execute one (the order is up to you); when that one is done, execute the other.

    You cannot combine an Update query with an Append query into one query.

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

Similar Threads

  1. Replies: 8
    Last Post: 11-01-2013, 01:59 PM
  2. Undo one action only
    By zoooza84 in forum Access
    Replies: 5
    Last Post: 08-21-2011, 03:04 PM
  3. Can't run this action???
    By wwg77 in forum Programming
    Replies: 2
    Last Post: 02-02-2011, 03:22 PM
  4. Macro Action
    By Bakar in forum Forms
    Replies: 1
    Last Post: 01-05-2011, 12:38 PM
  5. No action button
    By dlewicki in forum Forms
    Replies: 6
    Last Post: 12-02-2009, 12:58 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