|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
SQL Questioncreate that should show the products sold within the current month only. i am using data reports within VB6, and using the recordset object to create the report. the problem i am having is with the sql statement. Somone from my previous reply (thank you very much for your help) suggested the following statements: SELECT Product.ProductID, Product.ProductName, OrderItem.Quantity, Orders.`Date` FROM OrderItem INNER JOIN Product ON OrderItem.ProductID = Product.ProductID INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID WHERE YEAR(Orders.'Date') = YEAR(GETDATE()) AND MONTH(Orders.'Date') = MONTH (GETDATE()) but with this sql, i am getting the following error: syntax error: missing operator in query expression 'INNER JOIN Product ON OrderItem.ProductID = Product.ProductID INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID' also, does vb recognise the the where clause: WHERE YEAR(Orders.'Date') = YEAR(GETDATE()) AND MONTH(Orders.'Date') = MONTH (GETDATE()) can anyone help. regards
Show quote
Hide quote
"Pinto1uk" <Pinto***@discussions.microsoft.com> wrote in message What is the backend database? SQL Server, Access/Jet, Oracle, ??news:F775D8B6-C7BD-42DA-B15C-CC114EC0A93C@microsoft.com > Hi, i posted a question a few weeks ago, regarding a report i wanted > to create that should show the products sold within the current month > only. i am using data reports within VB6, and using the recordset > object to create the report. > > the problem i am having is with the sql statement. Somone from my > previous reply (thank you very much for your help) suggested the > following statements: > > SELECT Product.ProductID, Product.ProductName, > OrderItem.Quantity, Orders.`Date` > FROM OrderItem > INNER JOIN Product ON OrderItem.ProductID = Product.ProductID > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID > WHERE YEAR(Orders.'Date') = YEAR(GETDATE()) AND MONTH(Orders.'Date') > = MONTH (GETDATE()) > > but with this sql, i am getting the following error: > > syntax error: missing operator in query expression 'INNER JOIN > Product ON OrderItem.ProductID = Product.ProductID > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID' > also, does vb recognise the the where clause: VB doesn't recognize any of it; VB puts the text of the query into a String> > WHERE YEAR(Orders.'Date') = YEAR(GETDATE()) AND MONTH(Orders.'Date') > = MONTH (GETDATE()) and sends the whole thing off to the database engine to figure it out. -- Reply to the group so all can participate VB.Net: "Fool me once..." Hi, the back end database is access. if vb does not recognise the statements,
how do i achieve my objectives? regards Show quoteHide quote "Bob Butler" wrote: > "Pinto1uk" <Pinto***@discussions.microsoft.com> wrote in message > news:F775D8B6-C7BD-42DA-B15C-CC114EC0A93C@microsoft.com > > Hi, i posted a question a few weeks ago, regarding a report i wanted > > to create that should show the products sold within the current month > > only. i am using data reports within VB6, and using the recordset > > object to create the report. > > > > the problem i am having is with the sql statement. Somone from my > > previous reply (thank you very much for your help) suggested the > > following statements: > > > > SELECT Product.ProductID, Product.ProductName, > > OrderItem.Quantity, Orders.`Date` > > FROM OrderItem > > INNER JOIN Product ON OrderItem.ProductID = Product.ProductID > > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID > > WHERE YEAR(Orders.'Date') = YEAR(GETDATE()) AND MONTH(Orders.'Date') > > = MONTH (GETDATE()) > > > > but with this sql, i am getting the following error: > > > > syntax error: missing operator in query expression 'INNER JOIN > > Product ON OrderItem.ProductID = Product.ProductID > > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID' > > What is the backend database? SQL Server, Access/Jet, Oracle, ?? > > > also, does vb recognise the the where clause: > > > > WHERE YEAR(Orders.'Date') = YEAR(GETDATE()) AND MONTH(Orders.'Date') > > = MONTH (GETDATE()) > > VB doesn't recognize any of it; VB puts the text of the query into a String > and sends the whole thing off to the database engine to figure it out. > > -- > Reply to the group so all can participate > VB.Net: "Fool me once..." > > "Pinto1uk" <Pinto***@discussions.microsoft.com> wrote in message Jet gets upset if you do multiple joins without using () around the firstnews:A1858FC5-E83F-4586-A1D1-0194B49EE0D6@microsoft.com > Hi, the back end database is access. if vb does not recognise the > statements, how do i achieve my objectives? join; you also need to lose the tick marks around Date since that's for mysql, not jet; finally, Jet doesn't recognize getdate(), that's sql server. try this: dim s as string s="SELECT Product.ProductID, Product.ProductName," & _ "OrderItem.Quantity, Orders.Date " & _ "FROM (OrderItem INNER JOIN [Product] ON OrderItem.ProductID = Product.ProductID) " & _ "INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID " & _ "WHERE YEAR(Orders.Date) = " & Cstr(Year(Date)) & _ " AND MONTH(Orders.Date) = " & cstr(Month(Date)) -- Reply to the group so all can participate VB.Net: "Fool me once..." Are you using DAO or ADO. ADO barks like a hell when you use keywords as
field name without enclosing the feildname in brackets. So If Date is a field which I assume it is then enclose Date in brackets like [Date] not in quotes. Show quoteHide quote "Pinto1uk" <Pinto***@discussions.microsoft.com> wrote in message news:F775D8B6-C7BD-42DA-B15C-CC114EC0A93C@microsoft.com... > Hi, i posted a question a few weeks ago, regarding a report i wanted to > create that should show the products sold within the current month only. i am > using data reports within VB6, and using the recordset object to create the > report. > > the problem i am having is with the sql statement. Somone from my previous > reply (thank you very much for your help) suggested the following statements: > > SELECT Product.ProductID, Product.ProductName, > OrderItem.Quantity, Orders.`Date` > FROM OrderItem > INNER JOIN Product ON OrderItem.ProductID = Product.ProductID > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID > WHERE YEAR(Orders.'Date') = YEAR(GETDATE()) AND MONTH(Orders.'Date') = MONTH > (GETDATE()) > > but with this sql, i am getting the following error: > > syntax error: missing operator in query expression 'INNER JOIN Product ON > OrderItem.ProductID = Product.ProductID > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID' > > also, does vb recognise the the where clause: > > WHERE YEAR(Orders.'Date') = YEAR(GETDATE()) AND MONTH(Orders.'Date') = MONTH > (GETDATE()) > > can anyone help. > regards > > I am using ADO, and date is a data field. but the error is poiting towards
the inner join statements. regards Show quoteHide quote "JP Bless" wrote: > Are you using DAO or ADO. ADO barks like a hell when you use keywords as > field name without enclosing the feildname in brackets. So If Date is a > field which I assume it is then enclose Date in brackets like [Date] not in > quotes. > > "Pinto1uk" <Pinto***@discussions.microsoft.com> wrote in message > news:F775D8B6-C7BD-42DA-B15C-CC114EC0A93C@microsoft.com... > > Hi, i posted a question a few weeks ago, regarding a report i wanted to > > create that should show the products sold within the current month only. i > am > > using data reports within VB6, and using the recordset object to create > the > > report. > > > > the problem i am having is with the sql statement. Somone from my previous > > reply (thank you very much for your help) suggested the following > statements: > > > > SELECT Product.ProductID, Product.ProductName, > > OrderItem.Quantity, Orders.`Date` > > FROM OrderItem > > INNER JOIN Product ON OrderItem.ProductID = Product.ProductID > > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID > > WHERE YEAR(Orders.'Date') = YEAR(GETDATE()) AND MONTH(Orders.'Date') = > MONTH > > (GETDATE()) > > > > but with this sql, i am getting the following error: > > > > syntax error: missing operator in query expression 'INNER JOIN Product ON > > OrderItem.ProductID = Product.ProductID > > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID' > > > > also, does vb recognise the the where clause: > > > > WHERE YEAR(Orders.'Date') = YEAR(GETDATE()) AND MONTH(Orders.'Date') = > MONTH > > (GETDATE()) > > > > can anyone help. > > regards > > > > > > > Have a look at this
SELECT Product.ProductID, Product.ProductName, OrderItem.Quantity, [Orders.Date], (DatePart('m',[Orders.Date]) As CurrentMonth, (DatePart('yyyy', [Orders.Date]) As CurrentYear FROM OrderItem INNER JOIN Product ON OrderItem.ProductID = Product.ProductID INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID WHERE DatePart('m',[Orders.Date]=" & DatePart('m',Date) & " AND DatePart('yyyy',[Orders.Date] = " & DatePart('yyyy',Date) Show quoteHide quote "Pinto1uk" <Pinto***@discussions.microsoft.com> wrote in message news:27D7296B-94EE-40BA-9901-EF34E3BBB115@microsoft.com... > I am using ADO, and date is a data field. but the error is poiting towards > the inner join statements. > regards > > "JP Bless" wrote: > > > Are you using DAO or ADO. ADO barks like a hell when you use keywords as > > field name without enclosing the feildname in brackets. So If Date is a > > field which I assume it is then enclose Date in brackets like [Date] not in > > quotes. > > > > "Pinto1uk" <Pinto***@discussions.microsoft.com> wrote in message > > news:F775D8B6-C7BD-42DA-B15C-CC114EC0A93C@microsoft.com... > > > Hi, i posted a question a few weeks ago, regarding a report i wanted to > > > create that should show the products sold within the current month only. i > > am > > > using data reports within VB6, and using the recordset object to create > > the > > > report. > > > > > > the problem i am having is with the sql statement. Somone from my previous > > > reply (thank you very much for your help) suggested the following > > statements: > > > > > > SELECT Product.ProductID, Product.ProductName, > > > OrderItem.Quantity, Orders.`Date` > > > FROM OrderItem > > > INNER JOIN Product ON OrderItem.ProductID = Product.ProductID > > > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID > > > WHERE YEAR(Orders.'Date') = YEAR(GETDATE()) AND MONTH(Orders.'Date') = > > MONTH > > > (GETDATE()) > > > > > > but with this sql, i am getting the following error: > > > > > > syntax error: missing operator in query expression 'INNER JOIN Product ON > > > OrderItem.ProductID = Product.ProductID > > > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID' > > > > > > also, does vb recognise the the where clause: > > > > > > WHERE YEAR(Orders.'Date') = YEAR(GETDATE()) AND MONTH(Orders.'Date') = > > MONTH > > > (GETDATE()) > > > > > > can anyone help. > > > regards > > > > > > > > > > > > "JP Bless" <jp3BlessNoSpam@hotmail.com> wrote in message I've never gotten it to work without parensnews:%23DVynNtQGHA.5400@TK2MSFTNGP09.phx.gbl > Have a look at this > > SELECT Product.ProductID, Product.ProductName, > OrderItem.Quantity, [Orders.Date], (DatePart('m',[Orders.Date]) As > CurrentMonth, > > (DatePart('yyyy', [Orders.Date]) As CurrentYear FROM OrderItem > INNER JOIN Product ON OrderItem.ProductID = Product.ProductID > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID FROM (OrderItem INNER JOIN Product ON OrderItem.ProductID = Product.ProductID) INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID > WHERE DatePart('m',[Orders.Date]=" & DatePart('m',Date) & " AND The "m" and "yyyy" there need to have double quotes or VB is going to> DatePart('yyyy',[Orders.Date] = " & DatePart('yyyy',Date) complain -- Reply to the group so all can participate VB.Net: "Fool me once..." the single quote(s) signifies part of database field formula like
ssql = "Select format([Order.Date], 'mm/dd/yyyy') from tbl_Order Where " & "format([Order.Date], 'mm/dd/yyyy') " & format(Date, "mm/dd/yyyy") This will go through since the single quotes are passed on literally to the database (to be resolved by the database) while the double quote in the later part of format function will be resolved by VB... Thanks anyway. Where I used single quote means there is encapsulating outer double quotes. Show quoteHide quote "Bob Butler" <tiredofit@nospam.com> wrote in message news:%23WltyVtQGHA.1572@tk2msftngp13.phx.gbl... > "JP Bless" <jp3BlessNoSpam@hotmail.com> wrote in message > news:%23DVynNtQGHA.5400@TK2MSFTNGP09.phx.gbl > > Have a look at this > > > > SELECT Product.ProductID, Product.ProductName, > > OrderItem.Quantity, [Orders.Date], (DatePart('m',[Orders.Date]) As > > CurrentMonth, > > > > (DatePart('yyyy', [Orders.Date]) As CurrentYear FROM OrderItem > > INNER JOIN Product ON OrderItem.ProductID = Product.ProductID > > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID > > I've never gotten it to work without parens > FROM (OrderItem > INNER JOIN Product ON OrderItem.ProductID = Product.ProductID) > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID > > > WHERE DatePart('m',[Orders.Date]=" & DatePart('m',Date) & " AND > > DatePart('yyyy',[Orders.Date] = " & DatePart('yyyy',Date) > > The "m" and "yyyy" there need to have double quotes or VB is going to > complain > > -- > Reply to the group so all can participate > VB.Net: "Fool me once..." > "JP Bless" <jp3BlessNoSpam@hotmail.com> wrote in message I realize that but you also posted code that uses ' as a string delimiternews:OJ1SaetQGHA.4384@tk2msftngp13.phx.gbl > the single quote(s) signifies part of database field formula like > ssql = "Select format([Order.Date], 'mm/dd/yyyy') from tbl_Order > Where " & "format([Order.Date], 'mm/dd/yyyy') " & format(Date, > "mm/dd/yyyy") > > This will go through since the single quotes are passed on literally > to the database (to be resolved by the database) while the double > quote in the later > part of format function will be resolved by VB... > > Thanks anyway. for a VB function that is NOT part of the SQL text: >>> WHERE DatePart('m',[Orders.Date]=" & DatePart('m',Date) & " AND The first and third DatePart are being passed to SQL; the second and fourth>>> DatePart('yyyy',[Orders.Date] = " & DatePart('yyyy',Date) >> >> The "m" and "yyyy" there need to have double quotes or VB is going to >> complain are being evaulated by VB -- Reply to the group so all can participate VB.Net: "Fool me once..." Thanks Bob... you are right... thought the OP will figure the quotes since
his original post did not have right quotes anyway. Show quoteHide quote "Bob Butler" <tiredofit@nospam.com> wrote in message news:%23Y2UBvtQGHA.1264@TK2MSFTNGP10.phx.gbl... > "JP Bless" <jp3BlessNoSpam@hotmail.com> wrote in message > news:OJ1SaetQGHA.4384@tk2msftngp13.phx.gbl > > the single quote(s) signifies part of database field formula like > > ssql = "Select format([Order.Date], 'mm/dd/yyyy') from tbl_Order > > Where " & "format([Order.Date], 'mm/dd/yyyy') " & format(Date, > > "mm/dd/yyyy") > > > > This will go through since the single quotes are passed on literally > > to the database (to be resolved by the database) while the double > > quote in the later > > part of format function will be resolved by VB... > > > > Thanks anyway. > > I realize that but you also posted code that uses ' as a string delimiter > for a VB function that is NOT part of the SQL text: > > >>> WHERE DatePart('m',[Orders.Date]=" & DatePart('m',Date) & " AND > >>> DatePart('yyyy',[Orders.Date] = " & DatePart('yyyy',Date) > >> > >> The "m" and "yyyy" there need to have double quotes or VB is going to > >> complain > > The first and third DatePart are being passed to SQL; the second and fourth > are being evaulated by VB > > -- > Reply to the group so all can participate > VB.Net: "Fool me once..." > Another "crude method" especially since you are using access
sSQL = "SELECT Product.ProductID, Product.ProductName, OrderItem.Quantity, [Orders.Date], Format([Order.Date],'mm/yyyy') AS CurrentMonth FROM OrderItem INNER JOIN Product ON OrderItem.ProductID = Product.ProductID INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID WHERE Format([Order.Date],'mm/yyyy') ='" & Format(Date, "mm/yyyy") & "'" Show quoteHide quote "Pinto1uk" <Pinto***@discussions.microsoft.com> wrote in message news:27D7296B-94EE-40BA-9901-EF34E3BBB115@microsoft.com... > I am using ADO, and date is a data field. but the error is poiting towards > the inner join statements. > regards > > "JP Bless" wrote: > > > Are you using DAO or ADO. ADO barks like a hell when you use keywords as > > field name without enclosing the feildname in brackets. So If Date is a > > field which I assume it is then enclose Date in brackets like [Date] not in > > quotes. > > > > "Pinto1uk" <Pinto***@discussions.microsoft.com> wrote in message > > news:F775D8B6-C7BD-42DA-B15C-CC114EC0A93C@microsoft.com... > > > Hi, i posted a question a few weeks ago, regarding a report i wanted to > > > create that should show the products sold within the current month only. i > > am > > > using data reports within VB6, and using the recordset object to create > > the > > > report. > > > > > > the problem i am having is with the sql statement. Somone from my previous > > > reply (thank you very much for your help) suggested the following > > statements: > > > > > > SELECT Product.ProductID, Product.ProductName, > > > OrderItem.Quantity, Orders.`Date` > > > FROM OrderItem > > > INNER JOIN Product ON OrderItem.ProductID = Product.ProductID > > > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID > > > WHERE YEAR(Orders.'Date') = YEAR(GETDATE()) AND MONTH(Orders.'Date') = > > MONTH > > > (GETDATE()) > > > > > > but with this sql, i am getting the following error: > > > > > > syntax error: missing operator in query expression 'INNER JOIN Product ON > > > OrderItem.ProductID = Product.ProductID > > > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID' > > > > > > also, does vb recognise the the where clause: > > > > > > WHERE YEAR(Orders.'Date') = YEAR(GETDATE()) AND MONTH(Orders.'Date') = > > MONTH > > > (GETDATE()) > > > > > > can anyone help. > > > regards > > > > > > > > > > > > Hi, thank you guys for all your help. much apprecaited. i have inserted this
SQL solution given, but when running the program, i get the following error: run time error: '2147217900' syntax error (missing operartor) OrderItem.ProductID = Product.ProductID INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID any ideas? sorry for the troubles Show quoteHide quote "JP Bless" wrote: > Another "crude method" especially since you are using access > > > > sSQL = "SELECT Product.ProductID, Product.ProductName, > OrderItem.Quantity, [Orders.Date], Format([Order.Date],'mm/yyyy') AS > CurrentMonth FROM OrderItem INNER JOIN Product ON OrderItem.ProductID = > Product.ProductID > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID > > WHERE Format([Order.Date],'mm/yyyy') ='" & Format(Date, "mm/yyyy") & "'" > > > > > > > > "Pinto1uk" <Pinto***@discussions.microsoft.com> wrote in message > news:27D7296B-94EE-40BA-9901-EF34E3BBB115@microsoft.com... > > I am using ADO, and date is a data field. but the error is poiting towards > > the inner join statements. > > regards > > > > "JP Bless" wrote: > > > > > Are you using DAO or ADO. ADO barks like a hell when you use keywords as > > > field name without enclosing the feildname in brackets. So If Date is a > > > field which I assume it is then enclose Date in brackets like [Date] not > in > > > quotes. > > > > > > "Pinto1uk" <Pinto***@discussions.microsoft.com> wrote in message > > > news:F775D8B6-C7BD-42DA-B15C-CC114EC0A93C@microsoft.com... > > > > Hi, i posted a question a few weeks ago, regarding a report i wanted > to > > > > create that should show the products sold within the current month > only. i > > > am > > > > using data reports within VB6, and using the recordset object to > create > > > the > > > > report. > > > > > > > > the problem i am having is with the sql statement. Somone from my > previous > > > > reply (thank you very much for your help) suggested the following > > > statements: > > > > > > > > SELECT Product.ProductID, Product.ProductName, > > > > OrderItem.Quantity, Orders.`Date` > > > > FROM OrderItem > > > > INNER JOIN Product ON OrderItem.ProductID = Product.ProductID > > > > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID > > > > WHERE YEAR(Orders.'Date') = YEAR(GETDATE()) AND MONTH(Orders.'Date') = > > > MONTH > > > > (GETDATE()) > > > > > > > > but with this sql, i am getting the following error: > > > > > > > > syntax error: missing operator in query expression 'INNER JOIN Product > ON > > > > OrderItem.ProductID = Product.ProductID > > > > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID' > > > > > > > > also, does vb recognise the the where clause: > > > > > > > > WHERE YEAR(Orders.'Date') = YEAR(GETDATE()) AND MONTH(Orders.'Date') = > > > MONTH > > > > (GETDATE()) > > > > > > > > can anyone help. > > > > regards > > > > > > > > > > > > > > > > > > > >
Show quote
Hide quote
"Pinto1uk" <Pinto***@discussions.microsoft.com> wrote in message I think you need to postthe exact code that builds and executes the querynews:A78660EE-16D7-4001-B289-E2399DC543C7@microsoft.com > Hi, thank you guys for all your help. much apprecaited. i have > inserted this SQL solution given, but when running the program, i get > the following error: > > run time error: '2147217900' > > syntax error (missing operartor) > > OrderItem.ProductID = > Product.ProductID > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID > > any ideas? -- Reply to the group so all can participate VB.Net: "Fool me once..." Hi, thanks alot guys for all your help. i managed to solve the problem using
bob's solution. regards Show quoteHide quote "Pinto1uk" wrote: > Hi, thank you guys for all your help. much apprecaited. i have inserted this > SQL solution given, but when running the program, i get the following error: > > run time error: '2147217900' > > syntax error (missing operartor) > > OrderItem.ProductID = > Product.ProductID > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID > > any ideas? > > sorry for the troubles > > "JP Bless" wrote: > > > Another "crude method" especially since you are using access > > > > > > > > sSQL = "SELECT Product.ProductID, Product.ProductName, > > OrderItem.Quantity, [Orders.Date], Format([Order.Date],'mm/yyyy') AS > > CurrentMonth FROM OrderItem INNER JOIN Product ON OrderItem.ProductID = > > Product.ProductID > > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID > > > > WHERE Format([Order.Date],'mm/yyyy') ='" & Format(Date, "mm/yyyy") & "'" > > > > > > > > > > > > > > > > "Pinto1uk" <Pinto***@discussions.microsoft.com> wrote in message > > news:27D7296B-94EE-40BA-9901-EF34E3BBB115@microsoft.com... > > > I am using ADO, and date is a data field. but the error is poiting towards > > > the inner join statements. > > > regards > > > > > > "JP Bless" wrote: > > > > > > > Are you using DAO or ADO. ADO barks like a hell when you use keywords as > > > > field name without enclosing the feildname in brackets. So If Date is a > > > > field which I assume it is then enclose Date in brackets like [Date] not > > in > > > > quotes. > > > > > > > > "Pinto1uk" <Pinto***@discussions.microsoft.com> wrote in message > > > > news:F775D8B6-C7BD-42DA-B15C-CC114EC0A93C@microsoft.com... > > > > > Hi, i posted a question a few weeks ago, regarding a report i wanted > > to > > > > > create that should show the products sold within the current month > > only. i > > > > am > > > > > using data reports within VB6, and using the recordset object to > > create > > > > the > > > > > report. > > > > > > > > > > the problem i am having is with the sql statement. Somone from my > > previous > > > > > reply (thank you very much for your help) suggested the following > > > > statements: > > > > > > > > > > SELECT Product.ProductID, Product.ProductName, > > > > > OrderItem.Quantity, Orders.`Date` > > > > > FROM OrderItem > > > > > INNER JOIN Product ON OrderItem.ProductID = Product.ProductID > > > > > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID > > > > > WHERE YEAR(Orders.'Date') = YEAR(GETDATE()) AND MONTH(Orders.'Date') = > > > > MONTH > > > > > (GETDATE()) > > > > > > > > > > but with this sql, i am getting the following error: > > > > > > > > > > syntax error: missing operator in query expression 'INNER JOIN Product > > ON > > > > > OrderItem.ProductID = Product.ProductID > > > > > INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID' > > > > > > > > > > also, does vb recognise the the where clause: > > > > > > > > > > WHERE YEAR(Orders.'Date') = YEAR(GETDATE()) AND MONTH(Orders.'Date') = > > > > MONTH > > > > > (GETDATE()) > > > > > > > > > > can anyone help. > > > > > regards > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
|||||||||||||||||||||||