K
keers
Hi All,
i am trying to copy a record into the same table prior to updating the
original with a form. To achive this i am using the following code;
Dim fld As Field
With Me.RecordsetClone
.Bookmark = Me.Bookmark
Me.Recordset.AddNew
For Each fld In .Fields
'skip the PK field
If fld.Name <> "ResourceProjectID" Then
Me.Recordset.Fields(fld.Name) = fld.Value
'amend the value in one of the unique index fields
If fld.Name = "Date" Then
Me.Recordset.Fields(fld.Name) = Date
End If
End If
Next fld
Me.Recordset.Update
End With
Set fld = Nothing
As the code runs i get the following error;
Err Number =3164
Field cannot be updated
The field generating the error is called 'ActiveRecord' which is a
text field within the table. It can only be set to 'Yes or No' (google
searches suggest that using the yes/no datatype is not a good idea so
i create the same manually). The properties of the field are;
General
Required = No
Allow Zero Length = Yes
Indexed = No
Unicode Compression = Yes
IME Mode = No Control
IME Sentence Mode
Lookup
Display Control = List Box
Row Source Type = Value List
Row Source = Yes;No
Bound Column = 1
Column Count =1
Column Heads = No
any pointers as to why i am getting this error would be vey much
appreciated - and if there is a better way of copying a record that
would be a bonus.
Thanks for your time
Keers
i am trying to copy a record into the same table prior to updating the
original with a form. To achive this i am using the following code;
Dim fld As Field
With Me.RecordsetClone
.Bookmark = Me.Bookmark
Me.Recordset.AddNew
For Each fld In .Fields
'skip the PK field
If fld.Name <> "ResourceProjectID" Then
Me.Recordset.Fields(fld.Name) = fld.Value
'amend the value in one of the unique index fields
If fld.Name = "Date" Then
Me.Recordset.Fields(fld.Name) = Date
End If
End If
Next fld
Me.Recordset.Update
End With
Set fld = Nothing
As the code runs i get the following error;
Err Number =3164
Field cannot be updated
The field generating the error is called 'ActiveRecord' which is a
text field within the table. It can only be set to 'Yes or No' (google
searches suggest that using the yes/no datatype is not a good idea so
i create the same manually). The properties of the field are;
General
Required = No
Allow Zero Length = Yes
Indexed = No
Unicode Compression = Yes
IME Mode = No Control
IME Sentence Mode
Lookup
Display Control = List Box
Row Source Type = Value List
Row Source = Yes;No
Bound Column = 1
Column Count =1
Column Heads = No
any pointers as to why i am getting this error would be vey much
appreciated - and if there is a better way of copying a record that
would be a bonus.
Thanks for your time
Keers