PC Review


Reply
Thread Tools Rate Thread

Append Query

 
 
entjed
Guest
Posts: n/a
 
      22nd Feb 2010
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.
 
Reply With Quote
 
 
 
 
RonaldoOneNil
Guest
Posts: n/a
 
      22nd Feb 2010
Put this this code behind the click of your button with the relevant query name

DoCmd.OpenQuery "YourAppendQueryName"

"entjed" wrote:

> 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.

 
Reply With Quote
 
entjed
Guest
Posts: n/a
 
      22nd Feb 2010
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" wrote:

> Put this this code behind the click of your button with the relevant query name
>
> DoCmd.OpenQuery "YourAppendQueryName"
>
> "entjed" wrote:
>
> > 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.

 
Reply With Quote
 
tbs
Guest
Posts: n/a
 
      25th Feb 2010
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" wrote:

> 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" wrote:
>
> > Put this this code behind the click of your button with the relevant query name
> >
> > DoCmd.OpenQuery "YourAppendQueryName"
> >
> > "entjed" wrote:
> >
> > > 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Append query - Append to table with Autonumber field Boon Microsoft Access Queries 2 29th Jun 2009 06:23 PM
Append query to append lots of record with range input domibud Microsoft Access Queries 7 9th May 2008 02:26 AM
Append Query in VBA - to append VBA variable values to Access tabl =?Utf-8?B?QWdlbnQgRGFnbmFtaXQ=?= Microsoft Access VBA Modules 4 1st Nov 2006 04:25 PM
Link CSV file created query append query to append data =?Utf-8?B?ZXNwYXJ6YW9uZQ==?= Microsoft Access Queries 2 5th Jul 2005 04:49 PM
Append Query... Can't Create a Unique Number to Append Vance Microsoft Access Queries 8 17th Dec 2003 11:18 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:56 PM.