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!

can't attach recordset to form?

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
GB
Can someone please explain what the problem is with this code?

I have an SP passthrough query and obtain the records with...

Code:
    Dim rs As DAO.Recordset
    Set rs = CurrentDb.OpenRecordset("spCommunicatorSearch")

This runs fine, if i issue an rs.movelast and then msgbox rs.recordcount, it shows me an accurate record count.

However, as soon as i then try to bind it to the form with ...
Code:
Me.Recordset = rs

I get an error
Object variable or with block variable not set (91)

Why?

Thanks,

1DMF.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

MIME::Lite TLS Email Encryption - Perl v0.02 beta
 
Dang, no sooner do I post I then find a thread on G! which shows me my faux pas -
Code:
[b][COLOR=#ff0000]Set[/color][/b] Me.Recordset = rs

Never used 'Set' against 'Me' before!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

MIME::Lite TLS Email Encryption - Perl v0.02 beta
 
Never used 'Set' against 'Me' before!

You are not using it "against" me, you are using it "against" Recordset.
You are setting the Recordset object = to another recordset. You are right, in that you could never do something like
Set Me = some object.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top