Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is there a Record Copy command?

Status
Not open for further replies.

northernbeaver

Programmer
Jul 9, 2001
164
CA
I have a table where there are about 40 fields in it. this is inputed by the user via a form. they have requested a copy button that will duplicate the information to a new record, excluding the index key of course. without making 40 variables for each field in the table and creating a new record and placing the info into the record is there a way to do it all at once?

I know the code that access has under the copy wizard doesnt work because of the unique Identifier. but I know in Visual Foxpro they have a command called SCATTER MEMVAR and GATHER MEMVAR that does what Im looking for. does such a command exsist in Access 2000 VBA?
 
You're in luck:

Code:
  RunCommand acCmdSelectRecord
  RunCommand acCmdCopy
  RunCommand acCmdPasteAppend

And by the way, the Paste Append item is available from the Edit menu. [bugeyed]

VBSlammer
redinvader3walking.gif

[sleeping]Unemployed in Houston, Texas
 
thanks for the responce VBSlammer, I was aware of the paste Append in the Edit menu but I read a report on Microsofts Knowledge base stating that it doesnt work if an Autonumber field or index is present. thats why I went looking for the alternative, Ill try your selection and post my progress here. again, thanks :)
 
The easiest way is to make an append query. Tie a copy button to the append query and run it. make sure to include a where filter on the unique identifier (is the Key Field an autonumber?) If it is an Autonumber, that will be added automatically.

You can run a vba code to do it also, but its quicker in a sql query.

DV
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top