object doesn't support this property or method Error??

gmatriix

Registered User.
Local time
Today, 10:36
Joined
Mar 19, 2007
Messages
365
Hello All,

I am trying to get this to work. Basically, Im trying to copy the current records with the records of the subform and paste them in a new record.

I keep getting this error message "object doesn't support this property or method" It doesn't tell me where the error is or nothing???

What am I doing wrong?

Here is a simplified copy of the code.
Code:
Dim dbs As Database, Rst As Recordset
        Dim SRst As Recordset

        Dim scompany As String
        Dim saddress As String

'Subform fields

Dim sSequenceNumber As Long
Dim sSequenceDescription As String

On Error GoTo Err_btnDuplicate_Click

Set dbs = CurrentDb
Set Rst = Me.RecordsetClone
Set SRst = Me.RoutingSubform.Form.RecordsetClone

scompany = "" & Me!company
saddress = "" & Me!Address

'Subform Fields

sSequenceNumber = "" & Me!RoutingSubform!SequenceNumber
sSequenceDescription = "" & Me!RoutingSubform!SequenceDescription

 With Rst
           .AddNew
              !company = scompany
              !Address = saddress

'Subform fields

With SRst
     .AddNew
     !SequenceNumber = sSequenceNumber
     !SequenceDescription = sSequenceDescription

 .Update                     ' Save changes.
           .Move 0, .LastModified
        End With
        Me.Bookmark = Rst.Bookmark

Exit_btnduplicate_Click:
        Me.Refresh
        Exit Sub

Err_btnDuplicate_Click:
        MsgBox Error$
        Resume Exit_btnduplicate_Click:
End With
End Sub
 
In the interests of learning how to fish, temporarily comment out this line:

On Error GoTo Err_btnDuplicate_Click

and run the code. You'll be able to debug and see the exact line causing the problem. You could also set a breakpoint and step through it:

http://www.baldyweb.com/Debugging.htm
 

Users who are viewing this thread

Back
Top Bottom