how can I show the recordset data in a query?

J

Jose Perdigao

I would like to show the data from a recordset in a query.

Is it possible? how can i do?

thanks,
JP
 
J

Jose Perdigao

I mean query the term tha we use in ms access.
I'm using ms access 2003 and there you have, tables, queryes, forms, entc.

The question is.

I create a recordset using for example the following code
Dim rec As ADODB.recordset
DIM strSQL as String
Set rec = New ADODB.recordset
strSQL ="SELECT * FROM Customers
rec.Open strSQL, CurrentProject.Connection

-- now I need the code to show the data existing in rec (rec - recordset) in
a query or in a form

What can I do?

Thanks,

JP
 
J

Jose Perdigao

I know this code, it works if the there is textbox and if the cotrolsource is
matching with the fields of recordset.
That's why, i ask to show the recordset in queries

By another words, how can I show the recordset if the fields of recordset is
changing (names and number of the fields)?
Is it possible?

Another question.
- I know to bound a recordset to a form (if the texts box is matching to the
recordset fields)
-I know to bound a recordset to a listbox or combo box.

Question.
How can I bound a recordset to a chart in MS Access 2003?

Thanks,

JP
 
S

Stefan Hoffmann

hi Jose,

Jose said:
I know this code, it works if the there is textbox and if the cotrolsource is
matching with the fields of recordset.
That's why, i ask to show the recordset in queries
Use alias names for the fields, bind these aliases to your controls.
By another words, how can I show the recordset if the fields of recordset is
changing (names and number of the fields)?
Is it possible?
Don't use the * in your SQL statment.

E.g.:
SQL = "SELECT Field1 AS Bound1, Field2 AS Bound2 FROM..."
Question.
How can I bound a recordset to a chart in MS Access 2003?
Same trick. Use aliases.


mfG
--> stefan <--
 
J

Jose Perdigao

Thanks Stefan by suggestions.
Unfortunately doesn't work properly.
When I change the recordset, the heads names are the same.
Another problem, if the controls are less than fields what can I do?

I think the best solution is, open new form and create programmatically the
number of controls matching with the fields name and with the number of
fields.
But I don't know how I can create controls programmatically.
Do you have suggestions?
Thanks

JP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top