Can somebody help me in replacing some parts of a string with constants?
I will show at first the record source i have and then how i want to change it
The current record source is as follows
Dim Acc as string
Acc = " SELECT DISTINCTROW Orders.paymentid, Orders.invoicedate, Orders.PaymentMethodID,
Customers.Customerid, Customers.CompanyName, products.Productid, products.grade, products.code,
[order details].UnitPrice, [order details].Quantity, Customers.afid, Customers.kindid, Customers.bulstat,
Customers.taxid " & _
" FROM products INNER JOIN (Customers RIGHT JOIN (Orders INNER JOIN [order details] ON
Orders.orderid = [order details].OrderID) ON Customers.Customerid = Orders.customerid) ON
products.Productid = [order details].ProductID " & _
" WHERE (((Orders.paymentid) = True) And ((Year([invoicedate])) = 2003) And ((month([invoicedate])) = 1))
ORDER BY Orders.invoicedate;"
==================
Now i want to replace as follows
Dim Jahr As String Jahr = And ((Year([invoicedate])) = 2003)
Dim Monat As String Monat = And ((month([invoicedate])) = 1))
and the string part under question to read:
" WHERE (((Orders.paymentid) = True) & Jahr & Monat & ORDER BY Orders.invoicedate;"
I get a syntax error and i understand somewhere there is a mistake in my code.
I will show at first the record source i have and then how i want to change it
The current record source is as follows
Dim Acc as string
Acc = " SELECT DISTINCTROW Orders.paymentid, Orders.invoicedate, Orders.PaymentMethodID,
Customers.Customerid, Customers.CompanyName, products.Productid, products.grade, products.code,
[order details].UnitPrice, [order details].Quantity, Customers.afid, Customers.kindid, Customers.bulstat,
Customers.taxid " & _
" FROM products INNER JOIN (Customers RIGHT JOIN (Orders INNER JOIN [order details] ON
Orders.orderid = [order details].OrderID) ON Customers.Customerid = Orders.customerid) ON
products.Productid = [order details].ProductID " & _
" WHERE (((Orders.paymentid) = True) And ((Year([invoicedate])) = 2003) And ((month([invoicedate])) = 1))
ORDER BY Orders.invoicedate;"
==================
Now i want to replace as follows
Dim Jahr As String Jahr = And ((Year([invoicedate])) = 2003)
Dim Monat As String Monat = And ((month([invoicedate])) = 1))
and the string part under question to read:
" WHERE (((Orders.paymentid) = True) & Jahr & Monat & ORDER BY Orders.invoicedate;"
I get a syntax error and i understand somewhere there is a mistake in my code.