Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Time Error 7951 on DAO RecordsetClone

Status
Not open for further replies.

spikey4him

Programmer
Jul 23, 2001
3
GB
I have tried all the examples in the books and web sites I can find ... all fail with the same error message

Run Time Error "7951"
You entered an expression that has an invalid reference
to the recordsetclone property.

The debug takes me to the 'set' statement shown below

Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone

I have set in VBA under Tools>References>

Microsoft ActiveX Data Objects 2.1 Library
Microsoft ActiveX Data Objects Recordset 2.5 Library
Microsoft DAO 3.6 Object Library

All to no avail...

Spikey4him
 
Have you tried something on the lines of:

Dim rs As Object
Set rs = Me.Recordset.Clone

Nick
 
Thanks nickjar2,

I tried th following code:

Private Sub CboMoveTo_AfterUpdate()
Dim rst As Object
Set rst = Me.Recordset.Clone


If Not IsNull(Me.cboMoveTo) Then
With rst
.FindFirst "[CustomerID] = " & Me.cboMoveTo
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
End If
End Sub

But I get the following error message

Run Time Error 91
Object variable or with block variable not set

Any other ideas??

Simon
 
It seems to work fine on my pc. Have u checked the tools references in a code windpow and seen what is i there?

Nick
 
Yes Nick,

The following settings are in tools references

Microsoft ActiveX Data Objects 2.1 Library
Microsoft ActiveX Data Objects Recordset 2.5 Library
Microsoft DAO 3.6 Object Library

Simon
 
I can't work this one out. I get the

Run Time Error 91
Object variable or with block variable not set

when I comment the set rst = Me.Recordset.Clone.

All I can think of is placing a breakpoint od the Set and stepping through the code.

Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top