Query into Report textbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Help!

There are two things I would like to do First, I would like VBA to run the
following query:

InsQry1 = "SELECT surquestion.hhhead, surquestion.floor FROM surquestion
GROUP BY surquestion.hhhead, surquestion.floor;"

however, if I use the DoCmd.RunSQL I get a runtime error "2342". So how Do I
get the VBA to run the query

Second, I would like to output the results into two textboxs of a report (eg
Reports!Report1.Text1 and Reports!Report1.Text2). How do I reference the
query output? As I am rather a newbie please list all declarations.

Thanks
JMG
 
There are several methods of getting the results of a query into a report.
Since you are selecting two fields, I would suggest a subreport based on the
query. If you only need one field from one record, you could use DLookup().
 
I should have also stated that DoCmd.RunSQL is for action queries, not
select queries.
 
Back
Top