Dave
Dont laugh but here is my attempt
'Check if the Total sq ft of Products starting with 3 or 4 is over 100'
If Me.txtTotalSquareFeet >= 100 Then
Dim Conn As ADODB.Connection
Dim rst As ADODB.Recordset
Set Conn = New ADODB.Connection
Set rst = New ADODB.Recordset
Conn.Open CurrentProject.Connection
rst.Open "qryTotalSquareFeet", Conn, adOpenDynamic, adLockOptimistic
'qryTotalSquareFeet is looking for "Order Number" that is being
referenced on frmOrder
rst.MoveFirst
Do While Not rst.EOF
'Make Seling Price per unit 1.92
rst!fldProductSellingPrice = rst!fldUnitsperPerProduct * 1.92
'Change Extended Price
rst!fldExtendedSellingPrice = rst!fldProductSellingPrice * rst!fldQuantity
'Requery txttax,txtxSubtotal,txtOrderTotal
Me![frmOrderDetail].Form!txtTax.Requery
Me![frmOrderDetail].Form!txtSubTotal.Requery
Me![frmOrderDetail].Form!txtOrderTotal.Requery
rst.Update
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
Set Conn = Nothing
End If
I am getting a Run-time error(2147217900) Invalid SQL statement expected
delete,insert,procedure,select,update ???
I am getting it at
rst.Open "qryTotalSquareFeet", Conn, adOpenDynamic, adLockOptimistic
although I know by now that it may not be the statement actually causing
problem.
any thoughts on my approach and on error.
Thanks again
Joe
--
Thanks for any assistance
Klatuu said:
That would involve reading through the subform's recordset and changing the
value in VBA.
:
Thanks, I'm using Dsum that gets kicked off after everyline. I quess I am
having trouble figuring out how to make the price changes in previously
entered lines with out doing it manually.
--
Thanks for any assistance
:
If you look at the sample Northwind database that ships with Access, there is
an order form that has a form/subform set up, as you probably do with order
header as the main form and order detail as a subform. It has an example of
how to keep a total of a field in the subform. Using that method, you could
total your square feet and check the total after every line entry and make
adjustments there. I am guessing it would probably be in the after upate
event of the control where you enter the square feet.
--
Dave Hargis, Microsoft Access MVP
:
I have an Order form with a subform for the Order Detail. In the Subform,
the Product ID, Quantity (Square Feet), etc is entered. Then the next item,
etc. Here's the clitch - When the total square feet is over 100, the pricing
changes for all the items(starting with 3 or 4), including the items entered
previously. The pricing, extended pricing has to be recalculated and I would
like it to happen automatically. I will be tracking the total square ft as it
is entered What I would like is some guidance in approaching this situation.
There are 2 primary table tblOrders, tblOrderDetail and tblProducts. Like I
said, I am not looking for specific coding help but help in the approach I
take.