Marleen,
There may well be a more elegant way, but I use the 'FieldNames' function
below to create a list of fields in the form's underlying query, where
'exclFld' is field to be ignored (normally Autonumber primary index field).
Then I use the resultant list as follows:
db.Execute "INSERT INTO tIncomeAllocAdd SELECT " _
& FieldNames("tIncomeAlloc", "Counter") _
& " FROM tIncomeAlloc " _
& "WHERE RecNo = " & vReceiptNumber, dbFailOnError
Public Function FieldNames(tblName As String, exclFld As String) As String
On Error GoTo ErrorFieldNames
Dim fldNames As String, td As TableDef, qd As QueryDef, db As Database, fld
As Field
Set db = CurrentDb
Set qd = db.QueryDefs(tblName)
For Each fld In qd.Fields
If fld.Name <> exclFld Then
If fldNames <> "" Then
fldNames = fldNames & ", [" & fld.Name & "]"
Else
fldNames = "[" & fld.Name & "]"
End If
End If
Next
FieldNames = fldNames
Exit Function
ErrorFieldNames:
MsgBox Error$
Exit Function
End Function
Hope this helps.
--
Bob Darlington
Brisbane
"Marleen" <mm*****@earthlink.net> wrote in message
news:vQ*****************@newsread3.news.atl.earthl ink.net...
I have a database that manages my webstore. Each store item record has 26
fields. I would like to have a way when adding new items to be able to
just copy the previous item when most everything is the same for the current item
being added. Could someone offer a suggestion on how to accomplish this.
Thank you very much!
Marleen