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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assign ADO recordset to recordset property of subform

Status
Not open for further replies.

tekkyun

Technical User
Oct 23, 2003
122
GB
I am having problems assigning a temporary recordset to the recordset property of a sub form when I open the main form.

I can do this ok for main form using
Set application.Forms(Str).recordset=rs
(where rs is the temp recordset and str is the name of main form)

But I am struggling to do same with subform.

Any clues?

 
Hi, tekkyun,

And this does not work?
Code:
Set Application.Forms(Str)!SubformControlName.Form.Recordset = rs
Ken S.
 
Ken,
I get Type mismatch at this line.
Don't understand this as rs is valid recordset.

Could it be to to with the fact that I have created rs as temporary recordset within my routine?



 
tekkyun,

Oops. Something just jogged my memory. I think I remember reading somewhere that Access form recordsets are DAO by default. That may be why you are getting the type mismatch error.

Ken S.
 
Ken,
Thanks for that.
I have now made a number of changes and corrected the error.
I think my error was in the field defenitions of rs recordset.
Yes you are correct in that you do get type mismatch error when you assign form recordset to temp recordset
eg.
rs=SubformControlName.form.recordset
(where rs is ADODB.recordset)
But strangely no errors are reported in my code when reversed, eg
SubFormControlName.Form.Recordset=rs


Mike






 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top