PC Review


Reply
Thread Tools Rate Thread

Copy record in to the same table

 
 
bermetj@gmail.com
Guest
Posts: n/a
 
      6th Oct 2006
I have a form that pulls a list of Investigators from a Table (PI
Table), from which you can select a record and by clicking on (Edit
Record) button open another form and see details for this record. I am
trying to ease data entry and would like to make a (Copy) button that
would pull the selected record from (PI Table) and add it to the same
table as a new record leaving some fields blank. Thank you!

 
Reply With Quote
 
 
 
 
John Vinson
Guest
Posts: n/a
 
      6th Oct 2006
On 6 Oct 2006 09:30:20 -0700, "(E-Mail Removed)" <(E-Mail Removed)>
wrote:

>I have a form that pulls a list of Investigators from a Table (PI
>Table), from which you can select a record and by clicking on (Edit
>Record) button open another form and see details for this record. I am
>trying to ease data entry and would like to make a (Copy) button that
>would pull the selected record from (PI Table) and add it to the same
>table as a new record leaving some fields blank. Thank you!


Have the button run an Append query from the table to itself, using
the primary key field from the form as a criterion.

John W. Vinson[MVP]
 
Reply With Quote
 
bermetj@gmail.com
Guest
Posts: n/a
 
      7th Oct 2006

John Vinson wrote:
>
> Have the button run an Append query from the table to itself, using
> the primary key field from the form as a criterion.
>
> John W. Vinson[MVP]


It gives me a validation rule error. Some fileds that I would like to
leave blank while copying are required. Is there a way to copy the
selected record into a memory, populate the fields into the form and
then save it as a new record?

 
Reply With Quote
 
John Vinson
Guest
Posts: n/a
 
      7th Oct 2006
On 6 Oct 2006 16:36:15 -0700, "(E-Mail Removed)" <(E-Mail Removed)>
wrote:

>It gives me a validation rule error. Some fileds that I would like to
>leave blank while copying are required. Is there a way to copy the
>selected record into a memory, populate the fields into the form and
>then save it as a new record?


Sure, bit it's a bit more work. You'll need to copy each control's
value into a variable, move to the new record, and copy back into the
controls:

Dim vThis As Variant, vThat As Variant, vTheOther As Variant
vThis = Me!txtThis
vThat = Me!txtThat
vTheOther = Me!cboTheOther
DoCmd.GoToRecord acForm, Me.Name, acNewRecord
Me!txtThis = vThis
Me!txtThat = vThat
Me!cboTheOther = vTheOther


John W. Vinson[MVP]
 
Reply With Quote
 
bermetj@gmail.com
Guest
Posts: n/a
 
      12th Oct 2006
John Vinson wrote:
> Sure, bit it's a bit more work. You'll need to copy each control's
> value into a variable, move to the new record, and copy back into the
> controls:
>
> Dim vThis As Variant, vThat As Variant, vTheOther As Variant
> vThis = Me!txtThis
> vThat = Me!txtThat
> vTheOther = Me!cboTheOther
> DoCmd.GoToRecord acForm, Me.Name, acNewRecord
> Me!txtThis = vThis
> Me!txtThat = vThat
> Me!cboTheOther = vTheOther
>
>
> John W. Vinson[MVP]


Thank you!

 
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
Copy record into same table Ben Microsoft Access 1 10th Feb 2011 01:31 PM
Copy record in same table... lupo666 Microsoft Access 4 30th Jan 2010 09:04 AM
How do I copy a record from one table to another table in Access HMK Microsoft Access 1 7th Jul 2009 06:41 PM
copy current record to new record in another table =?Utf-8?B?Rm9vWUM=?= Microsoft Access VBA Modules 5 6th Jun 2005 03:09 AM
Copy Record within Same Table vseale Microsoft Access VBA Modules 2 10th Apr 2004 05:04 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:21 AM.