How To Automate Record Duplication

  • Thread starter Thread starter Kevin
  • Start date Start date
K

Kevin

You can create an append query to take information from
the forms current record and append it to a new record,
then for the date just add 1 to the date in the record.
Doing that may be difficult for you depending on how much
programming experience you have.

Instead, may I suggest just using a date range for the
entry. Have a Start Date for the activity and an end date.
That will be simpler. It will also prevent you from
duplicating a great dela of data which would use disk
space unecessarily.

If you still want to duplicate the information, post back
and we will give you some assistance.

Kevin
 
I do not have much programming experience. This option
will not be used all the time. Most of the time the sales
reps call on different customers each day. My current
database is working fine and I do not want to add a date
range. All I want to do is duplicate the current record
if the user chooses to do so. Any assistance you can
provide would be greatly appreciated.

Thanks!
 
I do not have much programming experience. This option
will not be used all the time. Most of the time the sales
reps call on different customers each day. My current
database is working fine and I do not want to add a date
range. All I want to do is duplicate the current record
if the user chooses to do so. Any assistance you can
provide would be greatly appreciated.

Thanks!
 
Jody,

First you need to create a query. I will go through all
this assuming you don't know how to do any of this, don't
take offense if I seem to simplistic but I don't have a
clue as to how much you do know how to do.

In the database window, find the queries tab. Click that
tab. If your using Access 97 there will be a Newbutton, in
Access 2002 (I believe Access 2000 is the same way) you
will find something in the Queries tab that says "Create
Query in Design view". In Access 97, after you press the
New button you will have to indicate to create the query
in design view. YOU DO NOT WANT TO USE A WIZARD HERE
because the wizards are for a specific kind of query like
an unmatched record query or a duplicate records query.
You don't need those here.

After you select to create the query in design view, you
will have to select your table or tables. After you do
that click the Close button.

Now select each field in the table you need to duplicate.
In the Criteria row of the Query builder you will need to
put criteria to select just the record you want
duplicated. From looking at your writeup from your first
post it sounds like Activity ID may be the appropriate
field to use. To do this though, the field will need to be
on your form. If you are not displaying Activity ID
probably a combination of the SalesRep and Date. To add
the criteria put the cursor in the field field for the
data field you want to select on. Right Click this field
and select Build from the list. Navigate to your form and
select the appropriate field. Press the OK button. You
should now have something in the Criteria field like the
following:

Forms![YourFormName]![YourFieldName]

When you have selected the criteria information you need,
save your query. Make sure you give it a meaningfull name
like QRY_Duplicate_SalesActivities. I use a prefix for all
my database objects so I can differentiate between the
types. I use QRY for queries, tbl for tables, frm for
forms, mod for module and mcr for macros.

You will need to modify the date field. Put the cursor in
the field at the end of the field name (top row). Right
Click and select build. Put a colon then an open
parenthasis just past the field name to the right.
Navigate to the table your querying from and find the Date
field. Doubleclick that field then put +1 after that. You
should have somethjing like:

Date:([tableName]![date]+1)

Now test your query. Open the form and set it up like you
have a recoird to duplicate. There is a key on the far
left that looks like a database table. If you put your
mouse pointer over the key it should popup a tool tip that
says View. Press this key. It should display the current
record. Check the date to be sure it did in fact add one
to the current date.

Now, change the query type to an append query. There is a
button in the middle of the toolbar that looks like two
tables, one behind the other. This one displays a tool tip
that says Query Type. There should be a downward pointing
arrow next to this button. Click the arrow. Select Append
Query.

Now you have to setup to run this query.

Put a button on the form from where you want to run this
query. After you drop the button on the form a Wizard will
popup. Press Cancel to cancel the wizard. Open the
properties for this button. You will see 5 tabs. On the
Event tab, put the cursor in the On Click event field.
Click the downward pointing arrow. You should see
something on the list that appears that looks like "[Event
Procedure]". Select that value. Click on the Elipses
(...). A VBA code page should appear. The cursor should be
between two lines that say something like:

Private Sub Command_Click()

End Sub

Between these two lines put the following:

Docmd.Setwarnings False
docmd.OpenQuery "YOurQueryNameHere"
docmd.SetWarnings True

I believe this should do it for you.

I hope that helps! Post back if you need more help!

Kevin

Kevin
 
Back
Top