C
CJ
Hi Groupies
I am using Allen Browne's code to duplicate a record on a form. However,
when I push the button to make it run I receive the error message "Error
438 - Object does not support this property or method"
I thought this problem had something to do with forms not being
loaded......not sure though. I do not need to duplicate the subform, just
the main.
Any insight would be greatly appreciated.
My code is as follows:
Dim strSql As String
Dim lngWOId As Long
'Save and edits first
If Me.Dirty Then
Me.Dirty = False
End If
'Make sure there is a record to duplicate.
If Me.NewRecord Then
MsgBox "Select the record to duplicate."
Else
'Duplicate the main record: add to form's clone.
With Me.RecordsetClone
.AddNew
WOSeq = fcnGetNextSequence
.RigName = Me.RigName
.RigLSD = Me.RigLSD
.RigProv = Me.RigProv
.CalledByID = Me.CalledByID
.Customer_ID = Me.Customer_ID
.Address1 = Me.Address1
.Directions = Me.Directions
.Notes = Me.Notes
.Update
'Save the primary key value, to use as the foreign key for the
related records.
.Bookmark = .LastModified
lngWOId = !lngWOId
'Display the new duplicate.
Me.Bookmark = .LastModified
End With
End If
I am using Allen Browne's code to duplicate a record on a form. However,
when I push the button to make it run I receive the error message "Error
438 - Object does not support this property or method"
I thought this problem had something to do with forms not being
loaded......not sure though. I do not need to duplicate the subform, just
the main.
Any insight would be greatly appreciated.
My code is as follows:
Dim strSql As String
Dim lngWOId As Long
'Save and edits first
If Me.Dirty Then
Me.Dirty = False
End If
'Make sure there is a record to duplicate.
If Me.NewRecord Then
MsgBox "Select the record to duplicate."
Else
'Duplicate the main record: add to form's clone.
With Me.RecordsetClone
.AddNew
WOSeq = fcnGetNextSequence
.RigName = Me.RigName
.RigLSD = Me.RigLSD
.RigProv = Me.RigProv
.CalledByID = Me.CalledByID
.Customer_ID = Me.Customer_ID
.Address1 = Me.Address1
.Directions = Me.Directions
.Notes = Me.Notes
.Update
'Save the primary key value, to use as the foreign key for the
related records.
.Bookmark = .LastModified
lngWOId = !lngWOId
'Display the new duplicate.
Me.Bookmark = .LastModified
End With
End If