Duplicate records from a table to another

Discuss the database features
Post Reply
yclee
Posts: 7
Joined: Sat Jul 30, 2011 6:05 am

Duplicate records from a table to another

Post by yclee »

Hi
I intent to duplicate the records found in the purchaseorder into salesorder using the form salesorder.
User can will select the purchase order with the list box @salesorder form and the respective info from purchaseorder (records) GICPN, Description, qty, purchaseorder will be copied from purchaseorder (records) to salesorder (records). How can this be done?

Anyone got any solution to help me
Attachments
GRIMMPOSO.odb
(35.72 KiB) Downloaded 190 times
Libreoffice 3 on WIndows XP
User avatar
DACM
Volunteer
Posts: 1138
Joined: Tue Nov 03, 2009 7:24 am

Re: Duplicate records from a table to another

Post by DACM »

Generally speaking, you can transfer one item (typically the primary key) from one Table to another using a List Box Control. For multiple items, this gets messy due to the number of List Boxes required (which wouldn't be an issue if List Boxes could be set to automatically store their default selection). But it may not be necessary to transfer multiple items from the purchaseorder record. I'll take a look at your download, but if it can't be done with a many-to-many junction Table, it may come down to Macros.

In the meantime, perhaps take a look at these examples/links.
.
AOO 4.1.x; LO 4.2.x; Windows 7/8 64-bit
Warning: Avoid embedded databases --> Solution: Adopt a portable 'split database' folder
Soli Deo gloria
yclee
Posts: 7
Joined: Sat Jul 30, 2011 6:05 am

Re: Duplicate records from a table to another

Post by yclee »

Base on your sample attached link,
I tried my version, it can transfer info from table to sql but it doesnt save into my table salesorderdetails??

DACM wrote:Generally speaking, you can transfer one item (typically the primary key) from one Table to another using a List Box Control. For multiple items, this gets messy due to the number of List Boxes required (which wouldn't be an issue if List Boxes could be set to automatically store their default selection). But it may not be necessary to transfer multiple items from the purchaseorder record. I'll take a look at your download, but if it can't be done with a many-to-many junction Table, it may come down to Macros.

In the meantime, perhaps take a look at these examples/links.
.
Attachments
GRIMMPOSO.odb
(37.2 KiB) Downloaded 189 times
Libreoffice 3 on WIndows XP
User avatar
DACM
Volunteer
Posts: 1138
Joined: Tue Nov 03, 2009 7:24 am

Re: Duplicate records from a table to another

Post by DACM »

Okay...I've had time to look at your file...

It looks like you're comfortable with Base, SQL, and the Form Navigator with respect to SubForm filtering. But your Tables could use some normalization. And your current Forms will probably require Macros to accomplish your display objectives. Specifically, the display of record-selections from other tables...while saving the reference(s) to the underlying Form table...all displayed within a single, writable, Table-Control grid...generally requires Macros. This is common with Invoice-looking forms in Base.

I used your file to generate the example below...but I really don't understand your workflow precisely. In other words, I don't understand what exactly you're trying to transfer to the SalesOrderDetails table. I presume its "GICPN" along with the related record-data from the PurchaseOrdersDetails table. And I didn't implement a quantity-tracking system because I didn't see one in-place.

To begin, I normalized your tables a bit to better leverage the SubForms (filtering) which minimizes the Macros:
GRIMMPOSO table structure
GRIMMPOSO table structure
And added the necessary Macros to automate things:
Attachments
GRIMMPOSO_4.odb
Fixed the corrupted SalesOrder Form
(39.07 KiB) Downloaded 240 times
GRIMMPOSO_3.odb
Macro-driven Invoice example with purchase & sales order forms
(39.24 KiB) Downloaded 288 times
AOO 4.1.x; LO 4.2.x; Windows 7/8 64-bit
Warning: Avoid embedded databases --> Solution: Adopt a portable 'split database' folder
Soli Deo gloria
Post Reply