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!

Show adodb recordset in form

Status
Not open for further replies.

daveonion

Programmer
Aug 21, 2002
359
GB
Hi I have an adodb recordset which is a query on a table in sql server. I can loop through the recordset fine and view each individual field but what I actually want to do is just view it as a grid ie datagrid or datasheet.

I can't seem to work out how to do this using Access, is it possible? The script for the recordset could change to point to a different query so the fields shouldn't be hard typed.

Thanks in advance for any help
 
Be cautious...
Code:
 Set Me.Recordset = rs 
 Set rs = Nothing

I have found that access sometimes trashes the form if you bind a recordset variable to a form and then set the recordset object to nothing!



"In complete darkness we are all the same, it is only our knowledge and wisdom that 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!"

Free Electronic Dance Music Download
 
Hi yeah I'm good thanks.

Maybe in my post I was nt so clear, I have already tried setting the record set to the adodb record set, however I don't want to add the fields as the source could change. What I'm basically after is a replication of a .net datagrid
 
Hi

The thing is I don't have a query I'm using an ado record set directly from Sql
Thanks
 
daveonion,
If all you truly want to do is "just view it as a grid ie datagrid or datasheet", then you can probably do this with:
- A form with a subform control on it
- A couple lines of code

Code:
   [COLOR=#4E9A06]'DAO reference required[/color]
   CurrentDb.QueryDefs("NameOfQuery").SQL = strSQLStatement
   Me.SubForm.SourceObject = "QUERY.NameOfQuery"

You don't have to worry about the field names or number of fields.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top