Duplicating error

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
 
A

Allen Browne

Which line generates the error?

It it's the customer id line, double-check whether there is a space or an
underscore in the name. If it's a space, you may need to use:
.[Customer ID] = Me.[Customer ID]
 
C

CJ

Brilliant. That solved the problem!

Thanks Allen.

--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!
Allen Browne said:
Which line generates the error?

It it's the customer id line, double-check whether there is a space or an
underscore in the name. If it's a space, you may need to use:
.[Customer ID] = Me.[Customer ID]

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top