Duplicate certain fields to new record then drop selection

  • Thread starter Thread starter dbl
  • Start date Start date
D

dbl

Hi, how do I set up a command button to copy selected fields in the record I
am in and paste them into a new record. I do not want to duplicate the full
record just certain fields.
When the fields have been added to the new record they must be cleared so
that the next time a new record is added it doesn't paste in the selected
fields again.

Any help with this one would be very much appreciated.

Bob
 
Not really as I only want to copy selected records at certain times not the
last record every time, plus I want to be anywhere in the record set and
copy that record to a new one. I have sent hours looking on the web for
idea's but so far I have not got anywhere.

Thanks anyway.

Bob
 
dbl said:
Hi, how do I set up a command button to copy selected fields in the record
I am in and paste them into a new record. I do not want to duplicate the
full record just certain fields.
When the fields have been added to the new record they must be cleared so
that the next time a new record is added it doesn't paste in the selected
fields again.

Any help with this one would be very much appreciated.

Bob

Something like this ought to work (air code):

Dim db As DAO.Database, rs As DAO.Recordset, strSQL As String
Set db = CurrentDb
strSQL = "Select [MyField1], [MyField2] from tblMyTable"
Set rs = db.OpenRecordset(strSQL)

With rs
.AddNew
![MyField1] = Me.txtTextBox1
![MyField2] = Me.txtTextBox2
.Update
End With

rs.Close
Set rs = Nothing
Set db = Nothing

Me.Refresh
Docmd.GotoRecord, acLast

HTH - Keith.
www.keithwilby.com
 
Something a little less complicated I use for the same purpose:

Private Sub CopyPartialRecordButton_Click()

'Copy fields to variables
MyFirstField = Me.FirstField
MySecondField = Me.SecondField
MyThirdField = Me.ThirdField

'Go to a new record
DoCmd.GoToRecord , , acNewRec

'Reverse the process and plug old values into new record
Me.FirstField = MyFirstField
Me.SecondField = MySecondField
Me.ThirdField = MyThirdField

End Sub

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
Thanks very much for all your help and support, it works fine, your time and
help is very much appreciated.
Bob
 
Back
Top