duplicate record button, excluding 1 field

G

Guest

I have a data entry form that I would like to add a "Copy Record" button
that uses the same data as the last record excluding one field "Call ID"
which is an autonumber feild and copying that value will give me a duplicate
value error for that record. Is there any code that will allow me to do so?


I have the following feilds on my form which are all bound to a query table.

( Event Date) (Caller) (Service Reps) (End User) (Name) (Phone number) (Item
number) (Part Description) (Description of non-conformance) (Type) (Problem /
Skill) (Assigned) (Status) (Next Status) (Next Status Date) (Queue) (PO
number) (Quanity of Defects) (UM) (Customers SCAR Number) (Total cost)
(Employee Number).

The purpose for the "Copy prevoius record" button would be to eleiminate the
person from having to type all data into the form when only 1 or 2 items
actually change, excluding the autonumber field. This would greatly expidite
entering data into the table (using the form as the data entry) without
having to re-type data that is the same from the prevoius record. I thought
that some databases used to have a simple ditto command that would copy the
data from the prevoius record onto the new record but I see that access does
not have this function directly.

I am unfamilar with VB so if that is required to accomplish the task please
explain in laymen's terms.

Thank you,

Jay
 
S

Steve Schapel

Jay,

Access does have a keyboard shortcut, which is Ctrl+' to automatically
enter the value of a field from the previous record.

Otherwise, you can use an Append Query to add a new record. Here is one
way to approach this... Make a query the same as the query that the form
is based on, and in the design view of the query, in the Criteria of the
Call ID field, put the equivalent of...
[Forms]![NameOfYourForm]![Call ID]
Then, make this an Append Query (select Append from the Query menu), and
nominate the name of your table. In the Append To row of the query
design grid, make sure all the relevant fields are entered for the
fields you want to transfer the data to, and make sure there is nothing
in the Append To row for the Call ID field. Close and save this
query... let's say you name the query CopyCall. Ok, then the VBA code
for the Click event of your Copy Record button will be like this...
DoCmd.SetWarnings False
DoCmd.OpenQuery "CopyCall"
DoCmd.SetWarnings True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top