MS Access Forum / Modules / DAO / VBA / March 2008
copy data
|
|
Thread rating:  |
leungkong - 07 Mar 2008 02:17 GMT Hi, I have set a form of proforma invoice worksheet, has 2 subforms. As we the actual qty of goods for ship to customer often has some difference with proforma. So, invoice qty <> proforma qty but most of data is similar. user want to issue invoice base on proforma's data. how to copy the data from proforma to invoice? many thanks
John W. Vinson - 07 Mar 2008 03:31 GMT >Hi, >I have set a form of proforma invoice worksheet, has 2 subforms. [quoted text clipped - 5 lines] >how to copy the data from proforma to invoice? >many thanks Care to describe your table structures, and the Forms' recordsources?
 Signature John W. Vinson [MVP]
leungkong - 07 Mar 2008 04:03 GMT Hi John, the form contains two subforms. main form is PIinfo, contains customer details & shipment terms, details. 1 st subform contains product details, such as product code, qty, unit price. 2 nd subform contains other charges, such as freight, handling, discourt (-ve), etc.. so 2 nd subform may be empty. Thanks Kong
> >Hi, > >I have set a form of proforma invoice worksheet, has 2 subforms. [quoted text clipped - 7 lines] > > Care to describe your table structures, and the Forms' recordsources? John W. Vinson - 07 Mar 2008 04:34 GMT >Hi John, >the form contains two subforms. [quoted text clipped - 5 lines] >Thanks >Kong Ok... what do you want copied? Do you really want it copied to the Form (which is after all just a window, not a data repository) or into the second subform's table? If the latter, are you at risk of storing data redundantly?
An Append query into the second table would probably be the best approach, but I'm not seeing any overlap between the two tables based on what you post, so it's hard to tell!
 Signature John W. Vinson [MVP]
leungkong - 07 Mar 2008 06:02 GMT > >Hi John, > >the form contains two subforms. [quoted text clipped - 13 lines] > I'm not seeing any overlap between the two tables based on what you post, so > it's hard to tell! Hi John, i want to copy the data from PI to inv database. i have used 3 table to contains the data for PI. and i using PI no. to link it up.
i want to set 3 table to contains the data for Inv. (same as PI) i want to copy PI data (3 tables) to inv database (3 table) than, generate a new inv no. to insteal of PI no. to link up 3 tables, PI no will be store it inv database for reference. Thanks for your reply and patient, it is the first time for me to use access.
John W. Vinson - 07 Mar 2008 06:12 GMT >Hi John, >i want to copy the data from PI to inv database. [quoted text clipped - 6 lines] >will be store it inv database for reference. >Thanks for your reply and patient, it is the first time for me to use access. What's the Master/Child Link Field of the subforms? If you set it to PI, it will fill in the PI value in the subform automatically, with no code at all, as soon as you enter any other data into the subform.
If you're trying to create an empty "placeholder" record in each subtable when you first create an inventory record, don't. It's neither necessary nor good practice to do so.
And if you're copying OTHER fields, storing the same data in two or three tables - *really* don't. Redundancy is redundant redundancy, and it's redundant as well! <g>
If I'm misunderstanding, please post a description of your tables in the form
Tablename Fieldname <datatype> <primary key> Fieldname <datatype> Fieldname <datatype>
and indicate how your tables are related.
 Signature John W. Vinson [MVP]
leungkong - 07 Mar 2008 07:01 GMT > >Hi John, > >i want to copy the data from PI to inv database. [quoted text clipped - 27 lines] > > and indicate how your tables are related. Hi John, It is not redundant. The reason is proforma is a reply for the Purchase order from customer. customer always change their mind, e.g. add more items or cancel order.
Another problem in the real world is, the qty of goods is not totally equal to proforma. e.g. the product is fabric, the qty of proforma is (length: 30yds), but actual ship out the qty of length may be 32yds.
additionally, although we issue proforma invoice, we may no reply from customer.
so, i need to create a invoice database to store the actual qty for generate report. do you have any idea or others easy way to solve this problem? Thanks.
John W. Vinson - 07 Mar 2008 17:48 GMT >so, i need to create a invoice database to store the actual qty for generate >report. You may well need an invoice TABLE - certainly not another database. In fact if you want to retain the pro-forma data and the invoice data for the same order concurrantly, and they're allowed to be different, you MUST have two tables.
>do you have any idea or others easy way to solve this problem? Probably an Append query to append records from the proforma table to the invoice table.
 Signature John W. Vinson [MVP]
leungkong - 08 Mar 2008 02:17 GMT Yes, John. I am going to creat an invoice table. the problem is: how to copy the data from proforma to invoice? Thanks.
"John W. Vinson" wrote an invice
> >so, i need to create a invoice database to store the actual qty for generate > >report. [quoted text clipped - 8 lines] > Probably an Append query to append records from the proforma table to the > invoice table. John W. Vinson - 08 Mar 2008 04:25 GMT >Yes, John. >I am going to creat an invoice table. >the problem is: >how to copy the data from proforma to invoice? >Thanks. Create a Query based on the Proforma table. Select the fields that you want to copy. Put a criterion on some suitable field of the query (I don't know which, I know nothing about the structure of your tables), probably referencing the form - e.g.
=Forms!YourFormName!SomeControlName
to select which record or records should be copied. Use the Query menu option to change this query to an Append query. Use the command button wizard to create a button which will run the query.
 Signature John W. Vinson [MVP]
|
|
|