Results 1 to 8 of 8
  1. #1
    xboxown is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    28

    Updating table in access from another access file.

    Hey,

    I have a question about a proper SQL query. I have a table called WorkOrderItem in an access file called AccessA and I want to update the data from the same table in a different access file called AccessB. How do I go about doing that?

    Thanks in advance.

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    One way is to create a link to the table in in the AccessB database. (External Data - New Data Source - From Database - Access). Once you have created the link, that table can be used the same as any local table can, including in SQL update sommands or as a form source.

  3. #3
    xboxown is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    28
    I keep getting syntax Update Statement. Why is that?

    UPDATE
    tblWorkOrderItem
    SET
    StockID=Table_B.StockID,
    CPNo=Table_B.CPNo,
    ProductID=Table_B.ProductID,
    Source=Table_B.Source,
    BFFGrade=Table_B.BFFGrade,
    Unit=Table_B.Unit,
    Price=Table_B.Price,
    IsTax1=Table_B.IsGST,
    IsTax2=Table_B.IsPST,
    IsTax3=Table_B.IsHST,
    PriceAdjustment=Table_B.PriceAdjustment,
    Quantity=Table_B.Quantity,
    Description=Table_B.Description,
    Height=Table_B.Height,
    Width=Table_B.Width,
    Length=Table_B.Length,
    [Note]=Table_B.[Note],
    BoardFeet=Table_B.BoardFeet,
    IsMedical
    SELECT tblWorkOrderItemExternal.StockID, tblWorkOrderItemExternal.CPNo, tblWorkOrderItemExternal.ProductID, tblWorkOrderItemExternal.Source, tblWorkOrderItemExternal.BFFGrade, tblWorkOrderItemExternal.Unit, tblWorkOrderItemExternal.Price, tblWorkOrderItemExternal.IsGST, tblWorkOrderItemExternal.IsPST, tblWorkOrderItemExternal.IsHST, tblWorkOrderItemExternal.PriceAdjustment, tblWorkOrderItemExternal.Quantity, tblWorkOrderItemExternal.Height, tblWorkOrderItemExternal.Width, tblWorkOrderItemExternal.Length, tblWorkOrderItemExternal.[Note], tblWorkOrderItemExternal.BoardFeet, tblWorkOrderItemExternal.IsMedical
    FROM tblWorkOrderItemExternal
    Where tblWorkOrderItemExternal.WorkOrderID=10348;

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    You are referring to your table as Table_B in one place and as tblWorkOrderItemExternal in the SELECT????

    Formatted sql

    UPDATE tblWorkOrderItem
    SET StockID = Table_B.StockID
    ,CPNo = Table_B.CPNo
    ,ProductID = Table_B.ProductID
    ,Source = Table_B.Source
    ,BFFGrade = Table_B.BFFGrade
    ,Unit = Table_B.Unit
    ,Price = Table_B.Price
    ,IsTax1 = Table_B.IsGST
    ,IsTax2 = Table_B.IsPST
    ,IsTax3 = Table_B.IsHST
    ,PriceAdjustment = Table_B.PriceAdjustment
    ,Quantity = Table_B.Quantity
    ,Description = Table_B.Description
    ,Height = Table_B.Height
    ,Width = Table_B.Width
    ,Length = Table_B.Length
    ,[Note] = Table_B.[Note]
    ,BoardFeet = Table_B.BoardFeet
    ,IsMedical

    SELECT tblWorkOrderItemExternal.StockID
    ,tblWorkOrderItemExternal.CPNo
    ,tblWorkOrderItemExternal.ProductID
    ,tblWorkOrderItemExternal.Source
    ,tblWorkOrderItemExternal.BFFGrade
    ,tblWorkOrderItemExternal.Unit
    ,tblWorkOrderItemExternal.Price
    ,tblWorkOrderItemExternal.IsGST
    ,tblWorkOrderItemExternal.IsPST
    ,tblWorkOrderItemExternal.IsHST
    ,tblWorkOrderItemExternal.PriceAdjustment
    ,tblWorkOrderItemExternal.Quantity
    ,tblWorkOrderItemExternal.Height
    ,tblWorkOrderItemExternal.Width
    ,tblWorkOrderItemExternal.Length
    ,tblWorkOrderItemExternal.[Note]
    ,tblWorkOrderItemExternal.BoardFeet
    ,tblWorkOrderItemExternal.IsMedical
    FROM tblWorkOrderItemExternal
    WHERE tblWorkOrderItemExternal.WorkOrderID = 10348

  5. #5
    xboxown is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    28
    That is ok. i resolved it without using going complex mode.

    Thanks though.

  6. #6
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    That is incorrect syntax for an SQL Update. SQL Update cannot use the Select... part - that is for an Insert Into statement. What is it you want to do - are you updating an existing record, or adding a new one?

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Perhaps you could show and/or describe the solution. It may just help someone with similar issue.

  8. #8
    xboxown is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    28
    Quote Originally Posted by orange View Post
    Perhaps you could show and/or describe the solution. It may just help someone with similar issue.
    My solution is not access related with SQL. I just simply deleted all the dummy data and that is it. Nothing query complex solution.

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

Similar Threads

  1. Replies: 1
    Last Post: 06-19-2017, 07:26 AM
  2. Export Access table data to flat file (txt file)
    By edmscan in forum Import/Export Data
    Replies: 3
    Last Post: 06-17-2015, 12:03 PM
  3. Replies: 12
    Last Post: 11-11-2014, 02:10 PM
  4. Replies: 3
    Last Post: 10-08-2014, 11:05 AM
  5. Updating Values in Excel File from Access After Query
    By Breezer23 in forum Programming
    Replies: 5
    Last Post: 03-24-2014, 08:52 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