By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,570 Members | 970 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,570 IT Pros & Developers. It's quick & easy.

How do you duplicate records with a primary key?

P: n/a
My database is set up so people can input parts orders. Sometimes they
order the same parts on a monthly basis. I want to be able to duplicate
past parts orders and have it pasted in with a new primary key.

My first attempt seemed to work(minus a few Microsoft glitches). I used
a "duplicate" command button at first. This made a copy of the record
but failed to bump up the primary key by 1 number(so it seemed).
Actually, the number did change, it just failed to display it. If I
moved back one record then back to my copied record, the number would
be different. This only bugs me becuase I need to immediately print the
copied record once it is created. The wrong primary key is displayed
when I print unless I scroll through the records before hand. This
doesn't bother me that much but I have about 10 people who use this
database (some remotely) and they get confused on this kind of stuff so
to avoid lengthy phone calls on how to use computer stuff (which I
don't get paid for) I decided not to spread the word on how to do it.

Now...as of today, it doesnt work at all. When I duplicate the record,
I get an error and it pastes the data to a "paste errors" table. (How
do I find out what the error was?)

All I need is the ability to duplicate a record from a form and have
that record appear with a new primary key.(I call them AP numbers)

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Sounds like your problem to solve is:

"create a duplicate a purchase order or invoice and give it a new PO or
invoice number?"

If this is the problem, then in a transaction
- begin transaction
- generate a new invoice number
- write the header record, using the new invoice number as the primary key
- if needed, put the old/previous invoice number in the new header
record's information to create a chain of references to past information
- write all the detail records using the new invoice number
- commit transaction

On Error then
Rollback transaction
Display error message
PS in a multiple user environment,
- when creating a new primary key
- have the most recent key created in a table
- read the table with DenyRead and update the value
- if denied read then loop until can read
HTH,

John Bickmore

"stranger" <th***@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
My database is set up so people can input parts orders. Sometimes they
order the same parts on a monthly basis. I want to be able to duplicate
past parts orders and have it pasted in with a new primary key.

My first attempt seemed to work(minus a few Microsoft glitches). I used
a "duplicate" command button at first. This made a copy of the record
but failed to bump up the primary key by 1 number(so it seemed).
Actually, the number did change, it just failed to display it. If I
moved back one record then back to my copied record, the number would
be different. This only bugs me becuase I need to immediately print the
copied record once it is created. The wrong primary key is displayed
when I print unless I scroll through the records before hand. This
doesn't bother me that much but I have about 10 people who use this
database (some remotely) and they get confused on this kind of stuff so
to avoid lengthy phone calls on how to use computer stuff (which I
don't get paid for) I decided not to spread the word on how to do it.

Now...as of today, it doesnt work at all. When I duplicate the record,
I get an error and it pastes the data to a "paste errors" table. (How
do I find out what the error was?)

All I need is the ability to duplicate a record from a form and have
that record appear with a new primary key.(I call them AP numbers)

Nov 13 '05 #2

P: n/a
Sorry dude, your talking crazy. I know the process, I just need a
solution. Something like a command button, or macro or something.

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.