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

Recordset from a QueryDef as form's recordsource

Status
Not open for further replies.

jonchaz

Programmer
Oct 25, 2001
8
US
Hello,

I am sure this is very easy, but I am having a problem with a recordset that I created from a Query in Access using createQueryDef. I have got the recordset opened and see that the values I want are populating the recordset, now I need to know how I assign it to form's recordset on the fly in code.

Is there a way to set the form's recordsource as this recordset? I am not sure of the right syntax in code to assign the recordset as the recordsource.

I have tried:

Set rst = dbsBar.OpenRecordset(frm.RecordSource, OpenDynaset)

but it will not work.

Any help would be appreciated. Sorry if this post is a bit confusing, it is late in the day and I am a morning person :)

jonchaz
 
You can assign any sql that returns a resultset to the forms recordsource in the OnOpen event.
examples.

Me.Recordsource = "select * from table1"
Me.Recordsource = aquery
Me.Recordsource = cmd.execute

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top