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

Show data from adodb recordset in subform grid

Status
Not open for further replies.

daveonion

Programmer
Aug 21, 2002
359
GB
Hi,

I haven't used access for a long long long time, but anyways what I am attempting to do is use a subform as datagrid and then show the data returned as a adodb recordset in the grid. The sql script will change so the user will basically be deciding which table they want to view.
Is there a way to do this? I currently use .net and would normally use a datagrid but my client needs access. I have been trying this for a few hours now and feel I am no closer to completion.


Thanks
 
Forms can be viewed as Data Sheets. You can set a form's recordsource property to a recordset object but I've not had cause to do it and I'm a bit fuzzy on if there are any timing issues.

You also have to have controls on the form for the data you want to display... so your Select can't be too dynamic unless you also want to dynamically change controls.

You might also consider...

1 Changing the subform used by the form in code (better choice if you have different columns)
2 Changing the underlying recordsource... there are two ways to get data into Access from a live database.... Recordsets and SQL Pass Through Queries. Typically the ODBC connection is setup on a query and then you programmatically change the SQL property of the the SPT query. Based on timing you may also need the REQUERY method of the form or subform.
 
I would add a subform container to a main form. Then use a little DAO to change the SQL property of a saved query. You can change the subform container's Source Object to the name of a saved query.

Sample

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

Part and Inventory Search

Sponsor

Back
Top