M
MikeJohnB
Hi again, I struglle with access vba but am more than proficient with Excel
which is why I get frustrated. Having said that, I have the following code.
Private Sub Command26_Click()
Me.Qty_Low = DMax("[Qty_High]", "Tbl_Price_Break", "[Record_Number]=" &
Me.Record_Number) + 1
Me.Qty_Low = DMax("[Qty_High]", "Tbl_Price_Break", "[Record_Number]=" &
Me.Record_Number) + 1
Me.Function = DLast("[Function]", "Tbl_Price_Break", "[Record_Number]=" &
Me.Record_Number)
Me.Part_Price_GBP = Me.Function * DLast("[Part_Price_GBP]",
"Tbl_Price_Break", "[Record_Number]=" & Me.Record_Number)
Me.Exchange_Rate = DLast("[Exchange_Rate]", "Tbl_Price_Break",
"[Record_Number]=" & Me.Record_Number)
Me.Part_Price_Euro = Me.Part_Price_GBP * Me.Exchange_Rate
Me.Qty_High = Me.Qty_Low + DLast("[Qty_High]", "Tbl_Price_Break",
"[Record_Number]=" & Me.Record_Number) - DLast("[Qty_Low]",
"Tbl_Price_Break", "[Record_Number]=" & Me.Record_Number)
Me.Refresh
End Sub
This code makes several calculations and populates fields with the results.
This works well but when the button is pressed to "Fill Breaks" the focus
stays with the current record which means that pressing the button again re
calcs the same record. I am not sure how to move the focus to a new record on
the sub form and a specific field? I have tried requery and recalc which have
the opposite effect of going to the first record.
Further, my subform is called Frm_Price_Break subform, while the button for
firing the calculations is on this form, why cant I select this form, would
it be because it needs the full form path?
Form!Frm_Main_Quotation_Data!Frm_Quotation subform!Frm_Price_Break subform to
select the ast subform????
Can anyone assist?????
which is why I get frustrated. Having said that, I have the following code.
Private Sub Command26_Click()
Me.Qty_Low = DMax("[Qty_High]", "Tbl_Price_Break", "[Record_Number]=" &
Me.Record_Number) + 1
Me.Qty_Low = DMax("[Qty_High]", "Tbl_Price_Break", "[Record_Number]=" &
Me.Record_Number) + 1
Me.Function = DLast("[Function]", "Tbl_Price_Break", "[Record_Number]=" &
Me.Record_Number)
Me.Part_Price_GBP = Me.Function * DLast("[Part_Price_GBP]",
"Tbl_Price_Break", "[Record_Number]=" & Me.Record_Number)
Me.Exchange_Rate = DLast("[Exchange_Rate]", "Tbl_Price_Break",
"[Record_Number]=" & Me.Record_Number)
Me.Part_Price_Euro = Me.Part_Price_GBP * Me.Exchange_Rate
Me.Qty_High = Me.Qty_Low + DLast("[Qty_High]", "Tbl_Price_Break",
"[Record_Number]=" & Me.Record_Number) - DLast("[Qty_Low]",
"Tbl_Price_Break", "[Record_Number]=" & Me.Record_Number)
Me.Refresh
End Sub
This code makes several calculations and populates fields with the results.
This works well but when the button is pressed to "Fill Breaks" the focus
stays with the current record which means that pressing the button again re
calcs the same record. I am not sure how to move the focus to a new record on
the sub form and a specific field? I have tried requery and recalc which have
the opposite effect of going to the first record.
Further, my subform is called Frm_Price_Break subform, while the button for
firing the calculations is on this form, why cant I select this form, would
it be because it needs the full form path?
Form!Frm_Main_Quotation_Data!Frm_Quotation subform!Frm_Price_Break subform to
select the ast subform????
Can anyone assist?????