PamSt
Technical User
- Nov 27, 2002
- 9
I have a customer database and I'm trying to change some SQL in to code. I have a customer form with a subform and I need information from both to open another form. My SQL minis the fields read
FROM Customer INNER JOIN Orders ON Customer.CustomerNumber = Orders.CustomerNumber
WHERE ((([Customer]![CustomerNumber])=[Forms]![NewOrder]![CustomerNumber]) AND (([Orders]![OrdersNumber])=[Forms]![NewOrder].[OrSub].[Form]![OrderNumber]));
I open the form with this query and it works fine but I would like to write it in code. I tried to write it like this:
DoCmd.OpenForm "ExpOrders",,, "CustomerNumber = '"& Me!CustomerNumber& "' And
OrderNumber = '"& Me!OrSub.Form!OrderNumber & "'"
I use this and I keep getting Errors, can anyone see what I'm doing wrong.
Thanks Pam.
FROM Customer INNER JOIN Orders ON Customer.CustomerNumber = Orders.CustomerNumber
WHERE ((([Customer]![CustomerNumber])=[Forms]![NewOrder]![CustomerNumber]) AND (([Orders]![OrdersNumber])=[Forms]![NewOrder].[OrSub].[Form]![OrderNumber]));
I open the form with this query and it works fine but I would like to write it in code. I tried to write it like this:
DoCmd.OpenForm "ExpOrders",,, "CustomerNumber = '"& Me!CustomerNumber& "' And
OrderNumber = '"& Me!OrSub.Form!OrderNumber & "'"
I use this and I keep getting Errors, can anyone see what I'm doing wrong.
Thanks Pam.