P
peljo via AccessMonster.com
I want to include the the value lngMaxOrderID which isn't used in the second
SQL string, so I am finding my Order DetailsTemp with records for many other
OrderIDs.
Therefore I tried to attach this value to the string, but then I get red
letters which means that my sql is not right.
Would yo uhelp me amend my second sql ?
Dim lngMaxOrderID As Long
Dim StrOrders As String
Dim strOrderDetails As String
lngMaxOrderID = DMax("[OrderID]", "orders1")
StrOrders = " SELECT orders1.* INTO ordersTemp FROM orders1 WHERE orders1.
Suborder = -1 and orders1.orderid = " & lngMaxOrderID
CurrentDb.Execute StrOrders
CurrentDb.Execute "CREATE INDEX PrimaryKey ON OrdersTemp (OrderID) WITH
PRIMARY"
strOrderDetails = "SELECT [order details1].orderid, [order details1].
productid, [order details1].cartons, [order details1].quantity " & _
" INTO [Order DetailsTemp] FROM [order details1] INNER JOIN orders1 ON [order
details1].OrderID = [orders1].orderid WHERE orders1.Suborder = -1 and orders1.
orderid = " & lngMaxOrderID"
CurrentDb.Execute strOrderDetails
SQL string, so I am finding my Order DetailsTemp with records for many other
OrderIDs.
Therefore I tried to attach this value to the string, but then I get red
letters which means that my sql is not right.
Would yo uhelp me amend my second sql ?
Dim lngMaxOrderID As Long
Dim StrOrders As String
Dim strOrderDetails As String
lngMaxOrderID = DMax("[OrderID]", "orders1")
StrOrders = " SELECT orders1.* INTO ordersTemp FROM orders1 WHERE orders1.
Suborder = -1 and orders1.orderid = " & lngMaxOrderID
CurrentDb.Execute StrOrders
CurrentDb.Execute "CREATE INDEX PrimaryKey ON OrdersTemp (OrderID) WITH
PRIMARY"
strOrderDetails = "SELECT [order details1].orderid, [order details1].
productid, [order details1].cartons, [order details1].quantity " & _
" INTO [Order DetailsTemp] FROM [order details1] INNER JOIN orders1 ON [order
details1].OrderID = [orders1].orderid WHERE orders1.Suborder = -1 and orders1.
orderid = " & lngMaxOrderID"
CurrentDb.Execute strOrderDetails