J
Jerry
Hi,
I'm having trouble accessing a field in a query from a textbox on a
subsubform.
Here's the scheme: form [Customer Orders] -record source query
[qryCustomers] - has a subform [sfmOrders] - record source
table [Orders] - which has a subform [sfmOrderDetails] -
recordsource query [qryOrderDetails].
Quantities and extended prices are totaled in the form footer section of
[sfmOrderDetails].
Table [tblDiscounts] contains a schedule of discounts that apply to
different ranges of values in the [txtQuanTotal] textbox that totals the
Quantity field of the [qryOrderDetails].
Fields of [tblDiscounts]:
[DiscountID] - Autonumber - primary key
[Low] - number - low end of the range for this discount rate
[High] - number - high end of the range for discount
[Discount] - number - discount rate for values between [High] and [Low]
Query [qryDiscounts] returns 1 record from [tblDiscounts] based on the value
in textbox [txtQuanTotal] which totals the Quantity field in all the records
in [qryOrderDetails] for the current order.
My problem is in retrieving the [Discount] value from [qryDiscounts]. In
textbox [txtDiscount], also in the form footer of [sfmOrderDetails].[Form],
I've tried '=[qryDiscounts]![Discount]', and
'=DLookUp("[Discount]","tblDiscounts","([txtQuanTotal] >= [Low]) and
([txtQuanTotal] <= [High])")', and every thing else I can think of. I think
the problem is that [qryDiscounts] is not part of [qryOrderDetails] - the
record source for the subform, but I can't seem to include it without
messing up [qryOrderDetails]. Shouldn't I be able to access the
[qryDiscounts]![Discount] value from an unbound text box in the subform?
I'm having trouble accessing a field in a query from a textbox on a
subsubform.
Here's the scheme: form [Customer Orders] -record source query
[qryCustomers] - has a subform [sfmOrders] - record source
table [Orders] - which has a subform [sfmOrderDetails] -
recordsource query [qryOrderDetails].
Quantities and extended prices are totaled in the form footer section of
[sfmOrderDetails].
Table [tblDiscounts] contains a schedule of discounts that apply to
different ranges of values in the [txtQuanTotal] textbox that totals the
Quantity field of the [qryOrderDetails].
Fields of [tblDiscounts]:
[DiscountID] - Autonumber - primary key
[Low] - number - low end of the range for this discount rate
[High] - number - high end of the range for discount
[Discount] - number - discount rate for values between [High] and [Low]
Query [qryDiscounts] returns 1 record from [tblDiscounts] based on the value
in textbox [txtQuanTotal] which totals the Quantity field in all the records
in [qryOrderDetails] for the current order.
My problem is in retrieving the [Discount] value from [qryDiscounts]. In
textbox [txtDiscount], also in the form footer of [sfmOrderDetails].[Form],
I've tried '=[qryDiscounts]![Discount]', and
'=DLookUp("[Discount]","tblDiscounts","([txtQuanTotal] >= [Low]) and
([txtQuanTotal] <= [High])")', and every thing else I can think of. I think
the problem is that [qryDiscounts] is not part of [qryOrderDetails] - the
record source for the subform, but I can't seem to include it without
messing up [qryOrderDetails]. Shouldn't I be able to access the
[qryDiscounts]![Discount] value from an unbound text box in the subform?