Results 1 to 8 of 8
  1. #1
    Adam1970 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2023
    Posts
    30

    append data from one form to another

    Hi

    I have a parent form "SalesForm" with a subform "SalesDetaiForm" i have identical parent & subform but named "PurchaseForm" & "PurchaseDetailForm".
    what i need to happen is once a button is pressed on the sales form it opens up the "purchaseform" & subform and adds the data from the "salesdetailform" to the PurchaseDetailForm.
    fields to be copied and added are as follows.


    ItemID
    Quantity
    QtyUnit
    the following can be null values
    Shape
    Dimension1
    Dimension2
    Comments

    I was toying with the idea of just using the "salesdetailform" and adding it to the "purchaseform" but would like purchase & sales records kept separate.
    Many thanks for your help
    Adam

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,557
    You do not add data to forms, you add data to tables that a form is based on. So use an append query.

    You could have one table by the sounds of it and a field to identify Sales, Purchases. However I am not sure why you want Sales added to Purchases?
    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

  3. #3
    Adam1970 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2023
    Posts
    30
    Hi
    The sales details (products) would be added to purchasing for ordering.
    I would need the salesID to control the append
    For example only append the open form data, and not the entire salesdetail table

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,557
    Quote Originally Posted by Adam1970 View Post
    Hi
    The sales details (products) would be added to purchasing for ordering.
    I would need the salesID to control the append
    For example only append the open form data, and not the entire salesdetail table
    OK, so use the SalesID as your append criteria?
    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

  5. #5
    Adam1970 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2023
    Posts
    30
    perfect thanks, just learning as i go

  6. #6
    Adam1970 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2023
    Posts
    30
    ive come across another issue. Append works fine it adds the data to the "PurchaseDetailT". what i need to happen is once the data has been appended, the parent form "PurchaseT" which contains the child form "PurchaseDetailT" opens with the appended details and to allow the parent form to be completed ie add vendor name etc. at present the appended data isnt creating a purchaseID in the "purchaseDetailT" as it does not exist yet.

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,557
    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

  8. #8
    Adam1970 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2023
    Posts
    30
    i have the following codes
    DoCmd.OpenQuery "appendpurchasedetailq"
    DoCmd.OpenForm "purchaseForm", , , "SalesID=" & SalesID
    this opens the form however it does not create the "purchaseT" primary key in the "PurchaseDetailT" to create the link between "purchaseT" & "purchasedetailT". I have added the "purchaseID" to the "purchasedetailform" and have added default value =[Forms]![PurchaseForm]![PurchaseID]. it pulls the number into the form field but does not populate to "purchasedetailT" .

    I have a check box on the query which only appends the true selections to the "PurchaseDetailT" if i have 10 items that are purchased from 2 vendors i would append the 1st items. when i attempt to append the 2nd items it adds it to the bottom of the 1st items, this is due to the same "SalesID" im using for the append criteria.

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

Similar Threads

  1. Replies: 4
    Last Post: 02-03-2021, 08:32 AM
  2. Replies: 5
    Last Post: 02-05-2013, 10:57 PM
  3. Replies: 3
    Last Post: 08-28-2012, 02:27 PM
  4. Form field to append data and link
    By joeuser in forum Access
    Replies: 1
    Last Post: 12-15-2011, 12:41 PM
  5. Replies: 5
    Last Post: 04-06-2011, 01:54 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