 |
| Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

September 25th, 2006, 11:33 PM
|
|
Registered User
|
|
Join Date: Sep 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Append Query to current active records
I'm trying to use an append query to copy data to be further modified leaving the original tables in tact.
The data is to come from two tables 'orders' & 'orders details' and append to two tables 'delivery' & 'delivery details'.
Assume the following:
âordersâ has âorderID-(AutoNumber)â, âcustomerâ & âcust_orderâ
âdeliveryâ has âdeliveryID-(AutoNumber)â âorderIDâ (combo), âcustomerâ & âcust_orderâ
âorder detailsâ has âorderIDâ, âitemâ, âdescriptionâ, âqtyâ & âpriceâ
âdelivery detailsâ has âdeliveryIDâ, âitemâ, âdescriptionâ, âqtyâ
Both âordersâ & âdeliveryâ have forms that show the respective details tables in a sub form (i.e. for item 1,2,3...).
Both âordersâ & âdeliveryâ have (AutoNumber) on their primary index (required).
âdeliveryâ form has a combo for selecting the relevant orders.orderID value to select the set of records to be appended.
I have created two append queries, one that appends required data from the âordersâ table to âdeliveryâ table, the second to append the data from the âorders detailsâ table to the âdelivery detailsâ table. (The thought being to run these together in a macro via a command button)
The second one seems to run OK as it will append the required data from âorder detailsâ into new records in the âdelivery detailsâ sub form and is linked back to âdeliveryâ by âdeliveryIDâ.
The problem I'm encountering is that when the first append query is run, I need the selected data from âordersâ to go into the current active records in âdeliveryâ.
The result I'm getting is that the selected data does append into the correct table & fields, however in the next new record.
i.e. if Iâm in âdelivery - formâ and creating a new entry, all text boxes are blank exept âdeliveryIDâ which is (AutoNumber).
I select the âordersIDâ combo and enter or pick the required value from the dropdown list which sets the criteria for data in âordersâ to be appended (lets say âordersIDâ = 1234), after selecting this the âdeliveryIDâ will be given a value automatically (lets say âdeliveryIDâ = 9876).
At this point the idea is to have a command button run the append query so that the corresponding values in âorders - customerâ & âorders - cust_orderâ are appended into the current open records in âdeliveryIDâ = 9876 not the next/new records.
The result I'm getting is the values in âorders - customerâ & âorders - cust_orderâ are appended into the next or new record set, âdeliveryâ table, âdeliveryIDâ = 9877
âdeliveryIDâ = 9876, âordersIDâ = 1234, âcustomerâ = blank & âcust_orderâ = blank
âdeliveryIDâ = 9877, âordersIDâ = blank, âcustomerâ = appended data & âcust_orderâ = appended data.
Can this be fixed so that the appended data for âordersIDâ = 1234 goes into the text boxes of âdeliveryIDâ = 9876 ????
|
|

September 26th, 2006, 07:02 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
I am not sure why you are doing this, but more importantly, why you are using a second autonumber field in the delivery table. You can use the autonumber field from the orders table to populate a number field in the delivery table, and use the number field as an index, no duplicates and get the same result. Perhaps this autonumber field in delivery is causing the problem. There is no need for it.
Did this help?
mmcdonal
|
|

September 26th, 2006, 08:33 AM
|
|
Registered User
|
|
Join Date: Sep 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
To explain the reason why I am setting it out this way, the database must match the business admin trail.
Essentially at the beginning a quote is raised (tables âquotesâ & âquote detailsâ).
If the quote is successful the data from that âquoteâ is appended to the âordersâ & âorders detailsâ tables where additional information is added such as customer order number and production details for internal use.
The invoice process uses this same unaltered data later, no appending to separate tables required.
The problem is that a delivery docket will not usually have the exact same data as the order & invoice, and sometimes a delivery docket is required for miscellaneous items that are not related to an order.
i.e. quote, order & invoice may all read âToyota sedan â model xyz, repair dent & paintâ in the details description, however the delivery docket will read âToyota sedan â model xyzâ as youâre delivering the item not the work performed. Furthermore the customer you quoted & invoiced may not necessarily be the one the item is to be shipped to.
For this reason it is preferable to simply append in the data from orders, then edit as necessary, without changing the original data in âordersâ & âorders detailsâ which are required later for invoicing and historical record of work performed.
We must have unique numbering for all quotes, orders, invoices, delivery dockets, etcâ¦
The orders primary autonumber only appears in the delivery form as a combo to select criteria for the append query to work.
The way it is setup now, the details tables part of the append query works very well both from âquote details to orders detailsâ, and âorders details to delivery detailsâ.
The one thing that is still giving me grief is to append from say âordersâ into the current records of âdeliveryâ instead of the next or new record.
|
|
 |