Easy one I think

  • Thread starter Thread starter Sandy
  • Start date Start date
S

Sandy

I have a project tracking database and I want to allow a
user to create a recurring project. I have opened a
recordset to get a single record and I would like to copy
this record as many times as the user has requested. The
only data that will change is the ID (autonumber) and the
projectDate. Will I need to copy the data for each field
individually... ie

rsrec.AddNew
rsRec("ProjectName")=rsRec("ProjectName")
....etc

Or is there an easier way of writing the data to the new
record. There are a lot of fields in the table so I am
just trying to find a shortcut.

Any ideas would be appreciated.

Thanks in advance
Sandy
 
basically you are duplicating a record?

you cant copy the record itself straight over, because the
ID field has to be unique

to answer you're question, yes you have to copy each field
individualy, as far as i know

id suggest using SQL, but its up to your preference:

Dim SQL As String

SQL = "INSERT " & _
"INTO MyTable ( Field1, Field2, ... ) " & _
"SELECT ( Field1, Field2, ... ) " & _
"FROM MyTable " & _
"WHERE ID = " & MyID & ";"

CurrentDb.Execute SQL, dbFailOnError
 
Back
Top