query Group by

  • Thread starter Thread starter kon
  • Start date Start date
K

kon

2 Questions : First can a recordset based on a groupby with sum fields query
and
Second Can I use that recordset to input data in a table using a Sql insert
into string?
Thanks In advance
I have a query witch is a group by with sums.
Can I use it in the vba code because when I tried to
open a recordset based on the query qrmasterstatlinked
rstmaster.Open "qrmasterstatlinked", cncurrent, adOpenStatic,
adLockOptimistic
A message appears "Ivnalid Sql statement;expected 'DELETE, INSERT,PROCEDURE,
SELECT, OR UPDATE.
and second the sql string based on the query doesn't work a messages says No
value given for one or more required parameters
sqlstring = "INSERT INTO masterdype (activeyear, dypeid, hospitalid,
degrees, served, dutied) SELECT varactiveyear, vardypeid , varhospitalid ,
vardegrees , varserved, vardutied FROM qrmasterstatlinked
 
Hi,


Yes, to both questions.

You didn't supply the SQL of your query, there is probably something wrong
with it.

Probably a simple

SELECT * FROM qrmasterstatlinked

won't work either, even in the query designer.


Hoping it may help,
Vanderghast, Access MVP
 
Here is my sql string and the message is "No
value given for one or more required parameters"

"INSERT INTO masterdype ( activeyear, dypeid, hospitalid, degrees, served,
dutied ) SELECT qrmasterstatlinked.activeyear, qrmasterstatlinked.dypeid,
qrmasterstatlinked.hospitalid, qrmasterstatlinked.degrees,
qrmasterstatlinked.sumofserved, qrmasterstatlinked.sumofdutied FROM
qrmasterstatlinked"
the masterdype is a table where I want the group by and sum results to be
entered and the qrmasterstatlinked is the query which is a group by. Please
tellme where am I doing wrong;
 
Hi,


Try


SELECT qrmasterstatlinked.activeyear, qrmasterstatlinked.dypeid,
qrmasterstatlinked.hospitalid, qrmasterstatlinked.degrees,
qrmasterstatlinked.sumofserved, qrmasterstatlinked.sumofdutied FROM
qrmasterstatlinked


in the query designer. There is probably a typo error in one of the field
you specified. Trying it in the query designer, you will be prompted for
this unknown field (due to a typo or otherwise).



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top