SQL to vb

  • Thread starter Thread starter msmuzila
  • Start date Start date
M

msmuzila

Can anyone please help me, i need to rewrite this sql query in vb so i
use it as a rowsource for a listbox. I need to do it this way because i
dont want to create a lot of querys.


SELECT Year([SHIP_DATE]) AS [Year], Sum(Invoices.TOTAL) AS Sales
FROM Invoices
WHERE (((Year([SHIP_DATE]))>Year(Now())-6) AND
((Invoices.FINALIZED)=True) AND
((Invoices.CODE)<>[forms]![Sale_Monthly]![N1] And
(Invoices.CODE)<>[forms]![Sale_Monthly]![N2] And
(Invoices.CODE)<>[forms]![Sale_Monthly]![N3]))
GROUP BY Year([SHIP_DATE]);


Thanks
Matt
 
Can anyone please help me, i need to rewrite this sql query in vb so i
use it as a rowsource for a listbox. I need to do it this way because
i dont want to create a lot of querys.


SELECT Year([SHIP_DATE]) AS [Year], Sum(Invoices.TOTAL) AS Sales
FROM Invoices
WHERE (((Year([SHIP_DATE]))>Year(Now())-6) AND
((Invoices.FINALIZED)=True) AND
((Invoices.CODE)<>[forms]![Sale_Monthly]![N1] And
(Invoices.CODE)<>[forms]![Sale_Monthly]![N2] And
(Invoices.CODE)<>[forms]![Sale_Monthly]![N3]))
GROUP BY Year([SHIP_DATE]);

What's the question?

A ListBox can use a SQL statement as its RowSource and you have a SQL statement.
What is it that you want to "rewrite"?
 
Back
Top