Append Query

  • Thread starter Thread starter entjed
  • Start date Start date
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.
 
Put this this code behind the click of your button with the relevant query name

DoCmd.OpenQuery "YourAppendQueryName"
 
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!
 
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"
 
Back
Top