Bobby Heid
bheid at appdevgrp.com
Wed Nov 15 06:41:44 CST 2006
Rocky, It will work, but you will have to name all of the fields except for fldJobMasterID, which will be created with he autonumber. Bobby -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Beach Access Software Sent: Wednesday, November 15, 2006 12:11 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Copy a record in a table Oops. My bad. fldJobMasterID is an the Autonumber PK of tblJobMaster. Won't work then, will it? Rocky -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan Sent: Tuesday, November 14, 2006 8:24 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Copy a record in a table On 14 Nov 2006 at 20:08, Beach Access Software wrote: > Stuart: > > I'm using > db.Execute "INSERT INTO tblJobMaster SELECT tblJobMaster.* FROM > tblJobMaster " _ > & "WHERE fldJobMasterID = " & rstJobMasterEquipmentIn!fldJobMasterID > > But I get the cryptic 'Too few parameters. Expected 1'. Can you see what > I'm doing wrong? WHile developing, try using strSQL = ..... Docmd.RunSQL strSQL instead of .Execute. You get much more helpful error messages that way. Just a WAG but is fldJobMasterID a PK or constrained to being unique? Creating a new record like this, you are trying to create another record in the table with ALL of the fields the same, including any unique fields,PK or otherwise. (You did ask originally to "duplicate" a record in a table)