How can I copy records like cut-n-paste 
Author Message
 How can I copy records like cut-n-paste

Hi:

I want to be able to pick a record and make many duplicates of it.  I know
that my primary key field(s) will not be able to be duplicated.  For that,
I want to stop when the record is about to be added so that I can change
the primary key to avoid duplication.  Then I want to copy the rest of the
record and keep on going, stopping everytime before adding a new record and
giving me the chance to change the primary key to avoid duplication.  Can
something like be done?  My record is quite a big one, containing
approximately 50 text fields etc.

Can this can be done?  Should I do it in DAO using GetRow method of
recordset or something like that.  Essentially need a good way of providing
"cut and paste" like feature so that the users can create similar records
quickly by just changing the primary key values.

Thanx

--
Asim K. Shafi



Sun, 20 Aug 2000 03:00:00 GMT  
 How can I copy records like cut-n-paste

If you're using Access, is there some reason you can't leverage the existing
Copy Record and Paste Record functionality from the edit menu?  This is the
sort of situation that the DoCmd object was built for...

    - Rebecca.

Quote:

>Hi:

>I want to be able to pick a record and make many duplicates of it.  I know
>that my primary key field(s) will not be able to be duplicated.  For that,
>I want to stop when the record is about to be added so that I can change
>the primary key to avoid duplication.  Then I want to copy the rest of the
>record and keep on going, stopping everytime before adding a new record and
>giving me the chance to change the primary key to avoid duplication.  Can
>something like be done?  My record is quite a big one, containing
>approximately 50 text fields etc.

>Can this can be done?  Should I do it in DAO using GetRow method of
>recordset or something like that.  Essentially need a good way of providing
>"cut and paste" like feature so that the users can create similar records
>quickly by just changing the primary key values.

>Thanx

>--
>Asim K. Shafi




Sun, 20 Aug 2000 03:00:00 GMT  
 How can I copy records like cut-n-paste

Hi,

Will make a "driver" table ( John Viescas' definition ) with a single field
with the records values: 1, 2, 3, 4, .......... n

Will bring both tables into the QBE grid. Don't join anyhow those two tables
together, just bring the driver field into the grid, add a criteria to it:

    <= [InitialTable].[RequiredQty]

Bring the other desired fields in the grid.

Run the query.

Why? Without any JOIN, even implicitly through the WHERE clause, you will
get each record or the initial table exactly n times (test in removing the
criteria). The implicit join through the WHERE clause limit those records
accordingly to the imposed condition. Simple, isn't it? (Note the WHERE
clause is, in fact, a JOIN since the condition spans two tables). Note: It
is not suggested to use implicit join through WHERE clause when it is
possible to do it through a simple JOIN, at least, in Access.

Hope it may help,
Vanderghast, Access MVP.

Quote:

>Hi:

>I want to be able to pick a record and make many duplicates of it.  I know
>that my primary key field(s) will not be able to be duplicated.  For that,
>I want to stop when the record is about to be added so that I can change
>the primary key to avoid duplication.  Then I want to copy the rest of the
>record and keep on going, stopping everytime before adding a new record and
>giving me the chance to change the primary key to avoid duplication.  Can
>something like be done?  My record is quite a big one, containing
>approximately 50 text fields etc.

>Can this can be done?  Should I do it in DAO using GetRow method of
>recordset or something like that.  Essentially need a good way of providing
>"cut and paste" like feature so that the users can create similar records
>quickly by just changing the primary key values.

>Thanx

>--
>Asim K. Shafi




Sun, 20 Aug 2000 03:00:00 GMT  
 How can I copy records like cut-n-paste

I have code in my system for duplicating a form and subform.  First the user
presses a command button and the Duplicate Form pops up.  The user is asked to
enter a new PO (key field).  On enter the code runs, checking if the PO is new
etc and duplicates the records.  When finished it leaves the user at the new
PO.

This code has elements of 3 or 4 people helping me out from here and there.  I
do not personally understand it that well.  If you want it, I'll send it.

I also have code that works in the same way for a form without a subform which
is based on only one table.  Like above, it asks for the new key field BEFORE
it runs.  Both do not run on autonumbers.

Doyle60



Sun, 03 Sep 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Cut, Copy, Paste

2. disabling cut/copy/paste

3. disabling copy/paste/cut on shape shortcut menu

4. Cut,Copy,Paste

5. cut, copy and paste

6. cut copy and paste

7. Cut, paste, copy questions...

8. Cut, Copy and Paste in the menu bar

9. Help Cut/Copy & Paste

10. cut, copy, and paste

11. cut/copy/paste

12. Cut/Copy/Paste

 

 
Powered by phpBB® Forum Software