display results of VBA SELECT Query

J

JCIrish

If I do a SELECT query in the Query design grid I can see the results in a
table by running the query or by switching to Datasheet view. I've written
the same query (and similar ones) in a VBA module by opening a recordset,
etc. The code complies and runs fine. (Thus, I can DeBug.Print to the
Immediate window various fields from the recordset). What I don't know how to
do (just a beginner in Access) is display the results in a table showing all
the returned records such as I can see using the query grid.

Can someone tell me how to proceed in order to do this? Do I need to start
with a form or something in which to display the results?
 
P

pietlinden

If I do a SELECT query in the Query design grid I can see the results in a
table by running the query or by switching to Datasheet view. I've written
the same query (and similar ones) in a VBA module by opening a recordset,
etc. The code complies and runs fine. (Thus, I can DeBug.Print to the
Immediate window various fields from the recordset). What I don't know how to
do (just a beginner in Access) is display the results in a table showing all
the returned records such as I can see using the query grid.

Can someone tell me how to proceed in order to do this? Do I need to start
with a form or something in which to display the results?

You can't really... well, you could create a listbox with the same
number of columns as the query you have built has fields, and then you
can use the .AddItem method of the listbox to add records to it - just
read them from the recordset instead of from a table/query.
 
J

JCIrish

Thanks for the response, and I'll try working with that. The end-point I'm
trying to get to is to use code to do some calculations on fields with
numerical data type that I haven't been able to work out using expressions in
the query design view.
 

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