izman23
03-24-2000, 03:12 PM
I have a form who's record source is a query. The user enters in two pieces
of data and then clicks on a command button (Go Look).
Once the record is located a second form is presented to the user with all
the data fields populated with that records information. The user can
overwrite information and then save it with a command button.
PROBLEM IS:
How can I set this up so that when the user overwrites information to record
the original information is stored and the overwritten data along with all
other data that wasn't changed is saved as a new record.
Here is some of the code that I've been working with. I get an debug
error 3020, trying to update or edit a record without using update or adnew.
GENERAL DECLARATION
DIM OldRec AS DAO.RECORDSET
DIM ModRec as DAO.RECORDSET
PRIVATE SUB FORM LOAD
SET OLDREC = FORM.RECORDSETCLONE
END SUB
SUB COMMANDSAVE_CLICK
Dim X as integer
SET MODREC = FORM.RECORDSETCLONE
for x = 0 to form.recordsetclone.fields.count -1
FORM.RECORDSETCLONE(X) = oldrec(x)
next x
FORM.RECORDSETCLONE.ADDNEW
for x = 0 to form.recordsetclone.fields.count -1
FORM.RECORDSETCLONE(X) = Modrec(x)
next x
FORM.RECORDSETCLONE.UPDATE
END SUB
Please, any help would be much appreciated.
of data and then clicks on a command button (Go Look).
Once the record is located a second form is presented to the user with all
the data fields populated with that records information. The user can
overwrite information and then save it with a command button.
PROBLEM IS:
How can I set this up so that when the user overwrites information to record
the original information is stored and the overwritten data along with all
other data that wasn't changed is saved as a new record.
Here is some of the code that I've been working with. I get an debug
error 3020, trying to update or edit a record without using update or adnew.
GENERAL DECLARATION
DIM OldRec AS DAO.RECORDSET
DIM ModRec as DAO.RECORDSET
PRIVATE SUB FORM LOAD
SET OLDREC = FORM.RECORDSETCLONE
END SUB
SUB COMMANDSAVE_CLICK
Dim X as integer
SET MODREC = FORM.RECORDSETCLONE
for x = 0 to form.recordsetclone.fields.count -1
FORM.RECORDSETCLONE(X) = oldrec(x)
next x
FORM.RECORDSETCLONE.ADDNEW
for x = 0 to form.recordsetclone.fields.count -1
FORM.RECORDSETCLONE(X) = Modrec(x)
next x
FORM.RECORDSETCLONE.UPDATE
END SUB
Please, any help would be much appreciated.