Append Query

E

entjed

I have created a table with about 40 fields. The primary key field is "ID".
I would like to select a record on my form and copy that record to the end of
the same table and let access assign a new ID (primary Key: autonumber). I
am new with programming and not familiar with "INSERT" command. I need to
copy the entire record, not just select fields. I created an Append Query
and when executed alone does exactly what I want it to do, but I don't know
how to insert this into the code (for button selection). Thanks.
 
R

RonaldoOneNil

Put this this code behind the click of your button with the relevant query name

DoCmd.OpenQuery "YourAppendQueryName"
 
E

entjed

I entered the code you suggested and the Append Query ran well. However, the
data I want to copy needs to be restricted to one record with a certain [ID]
value. This record is determined by which line on the form that is indicated
by the "record indicator". I have stored the [ID] value in a variable
"VisitID" and need to pass that to the append query so it copies only that
one record. Thanks for you help!
 
T

tbs

you can try creating parameter in your query and pass in the value when you
execute the query. There are many examples on how to use parameters in
queries on the web.

entjed said:
I entered the code you suggested and the Append Query ran well. However, the
data I want to copy needs to be restricted to one record with a certain [ID]
value. This record is determined by which line on the form that is indicated
by the "record indicator". I have stored the [ID] value in a variable
"VisitID" and need to pass that to the append query so it copies only that
one record. Thanks for you help!

RonaldoOneNil said:
Put this this code behind the click of your button with the relevant query name

DoCmd.OpenQuery "YourAppendQueryName"
 

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