• sql broken down (Access 2000)

    Author
    Topic
    #359427

    SQL broken down

    I have an sql broken down into parts,serving for other purposes.
    The parts of the query work fine except for two:
    sqlSmall and SQLSuppliers.
    It means that the SQL works fine in the following way :
    strBas = strHinge & strInvoice & strInvoiceDate
    But if i want to add sqlsmall or sqlsuppliers or both
    i receive errors.
    Can somebody help me? In order to be clear i will have to set down the whole lengthy function which is :

    Public Function Curves()
    Dim strBas As String
    Dim strHinge As String
    Dim strInvoiceDate
    Dim strBasHaving
    Dim strInvoice
    Dim strSmall
    Dim strSupplier as string

    strHinge = “SELECT DISTINCTROW Format([invoicedate],””yy-mm””) AS [Month], [Order Details].OrderID, [Order Details].ProductID, Products.grade, [Order Details].UnitPrice, [Order Details].Quantity, [Order Details].Discount, Products.size, Sum([Order Details].liters) AS Liters, orders.paymentid, orders.invoicedate, customers.afid, customers.Customerid, Suppliers.Supplierid FROM (Suppliers INNER JOIN Products ON Suppliers.Supplierid = Products.supplierid) INNER JOIN ((customers INNER JOIN orders ON (customers.Customerid = orders.customerid) AND (customers.Customerid = orders.customerid)) INNER JOIN [Order Details] ON orders.orderid = [Order Details].OrderID) ON Products.Productid = [Order Details].ProductID GROUP BY Format([invoicedate],””yy-mm””), [Order Details].OrderID, [Order Details].ProductID, Products.grade, [Order Details].UnitPrice, [Order Details].Quantity, [Order Details].Discount, Products.size, orders.paymentid, orders.invoicedate, customers.afid, customers.Customerid, Suppliers.Supplierid ”
    strInvoice = “HAVING (((orders.paymentid)>0) ”
    strInvoiceDate = “AND ((orders.invoicedate)>#1/1/2001#))”
    strSmall = “AND(( products.size) 0) AND ((orders.invoicedate)>#1/1/2001#))
    ORDER BY [Order Details].OrderID;

    Viewing 0 reply threads
    Author
    Replies
    • #538720

      Posting the SQL and code is a good first step, but what kind of errors are you getting, error messages, incorrect results or what? We need specifics about error messages oe what is being returned erroneously.

    Viewing 0 reply threads
    Reply To: sql broken down (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: