I want to Duplicate

  • Thread starter Thread starter Mercy
  • Start date Start date
M

Mercy

Hello! Merry Christmas!
Below is a simplified illustration of what I want to do.
I have Form A with fields:
Key fields:
PO#
ClientName
Other fields:
Other stuff...

Form A has quite a few subforms which are linked to Form
A via the PO#

I want to have the option to Duplicate Form A and all its
subforms, but change the PO#. I could just use the
Duplicate option that those Command Buttons offer. But
that doesn't really solve the problem because I will lose
all the data in the subforms after I change the value of
the PO#.

Here's an example of what I want to do:
Form A
PO#: N5
Client Name: Larry
Subform1
N5 Red
N5 Blue
N5 Green

Subform2
N5 Data1
N5 Data2

I want to be able to duplicate the Data and result in
PO#: N5-1
Client Name: Larry
Subform1
N5-1 Red
N5-1 Blue
N5-1 Green

Subform2
N5-1 Data1
N5-1 Data2

I'd appreciate any help!
 
-----Original Message-----
Hello! Merry Christmas!
Below is a simplified illustration of what I want to do.
I have Form A with fields:
Key fields:
PO#
ClientName
Other fields:
Other stuff...

Form A has quite a few subforms which are linked to Form
A via the PO#

I want to have the option to Duplicate Form A and all its
subforms, but change the PO#. I could just use the
Duplicate option that those Command Buttons offer. But
that doesn't really solve the problem because I will lose
all the data in the subforms after I change the value of
the PO#.
Hi Mercy, as you don't want to use the duplicate option
you can either use code to add a new record (DAO or ADO
use online help to look up recordsets) or create a
duplicate form to which you copy information across from
the existing record.

You don't lose the subform record information. It's just
that this information is linked to the original record's
PO#. In short you will have to duplicate the main record
and all its related records.

Luck
Jonathan
 
Mercy,

It may help you to recognise that forms and subforms do not have data.
The data is in your tables. All the forms do is display the data, and
give you access to it, but it will possibly ease some confusion if you
relate to the data where it really lives.

By the way, as a side issue, but worth mentioning... it is not a good
idea the use a # as part of the name of a field. I would change the
PO# to some other name that only uses letters or digits!

One way to achieve what you are describing would be to have a button
on your Form A to duplicate the records, and the macro or code
assigned to this button will run a series of Append Queries, one for
the main table, and one for each of the necessary related tables. I
would presume that the user would have to be prompted to supply the
PONumber for the new records.

- Steve Schapel, Microsoft Access MVP
 
Back
Top