Predmet:Queries to VBA
Imam edno Queri od koe imam izvadeno raport sega mi treba nesto slicno da go napravam za pecatejne preku VBA no ne mozam da go izvedam.
Eve go cql od od Querito
PreuzmiIzvorni kôd (Visual Basic):SELECT tblSmetki_Stavki.Stavka, Sum(tblSmetki_Stavki.Kolicina) AS Kolicina, tblSmetki_Stavki.Procent, tblSmetki_Stavki.Ed_Cena
FROM tblSmetki INNER JOIN tblSmetki_Stavki ON tblSmetki.ID_Smetka = tblSmetki_Stavki.Smetka_Br
WHERE (((tblSmetki.Data) Between [Forms]![frmPregled_Kasa_Restoran]![txtDataOD] And [Forms]![frmPregled_Kasa_Restoran]![txtDataDO]) AND ((tblSmetki.Magacin)=[Forms]![frmPregled_Kasa_Restoran]![cboMagacin]))
GROUP BY tblSmetki_Stavki.Stavka, tblSmetki_Stavki.Procent, tblSmetki_Stavki.Ed_Cena
ORDER BY Sum(tblSmetki_Stavki.Kolicina) DESC;
Eve kako go vadam recordsetot vo VBA
PreuzmiIzvorni kôd (Visual Basic):Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("qryKasa_Artikli_Top")
While Not rs.EOF
MsgBox rs.Fields(1)
rs.MoveNext
Wend
Set rs = Nothing