p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

access thread: Duplicating a record in a database


Message #1 by dfuas@h... on Mon, 3 Jun 2002 23:14:08
Hi Guys, 

I have a problem which is:

I am entering information in an Access database using a form. I want to be 
able to duplicate data, say I have 45 entries in a database and I need to 
have number 15 entry twice, such that if I hit a dupplicate button while 
on entry 15, this is entered as 15A and 15B. e.g the sequency of entries 
becomes 13, 14, 15, 15A, 15B, 16, 17...,etc.
Is this possible? Can you help

Thank you

Dinis 
Message #2 by "Randy Cornish" <rlcornish@c...> on Tue, 4 Jun 2002 00:52:48
Possible.  Yes.  Depends on how familiar you are with Access VBA coding.  
You can:
  A) Create a Primary Key which is a string datatype, but holds a numeric 
value until you sense a duplicate.  the issue is that you will need to 
assign the primary key yourself, writing a small function in code.  If 
the function cannot find a dup, it returns the same value.  If it does 
find a dup, it needs to: return an altered primary key and update the 
other record that was a dup.  Don't know if this is esy for you or not.

  B)  Carry two keys - a Primary Key which is an AutoNumber (Long) and 
keeps each record unique AND a string field (see (A) above).  In this 
scenario, you can actually insert the record right away and THEN sweep 
for dups.  You could even conceivably place the burden on the user (not 
recommended). 

Can be done, but not without writing some code (that I can think of).

R

> Hi Guys, 

> I have a problem which is:

> I am entering information in an Access database using a form. I want to 
be 
a> ble to duplicate data, say I have 45 entries in a database and I need 
to 
h> ave number 15 entry twice, such that if I hit a dupplicate button 
while 
o> n entry 15, this is entered as 15A and 15B. e.g the sequency of 
entries 
b> ecomes 13, 14, 15, 15A, 15B, 16, 17...,etc.
I> s this possible? Can you help

> Thank you

> Dinis 

  Return to Index