Jeanette,
I couldn't get that to work, but I tried DSum in the following way:
Dim FRSum = String
FRSum = DSum("[FlatRate]" , "5/10/2008")
Me.Text42.Value = FRSum
And that worked fine.
I'd like to change the domain portion of the DSum expression to use the
value of a combo box on my form [cboApptDate].
DSum("[FlatRate]" , "insert_string_expression & [cboApptDate]")
is this possible?
Paul
> Paul,
> here is an example using DLookup
[quoted text clipped - 72 lines]
> >> > Thanks in Advance,
> >> > Paul
Jeanette Cunningham - 13 May 2008 22:23 GMT
Paul,
yes, you use the DSum in a similar way to using DLookup.
Here are some examples from access vba help.
The following example totals the values from the Freight field for orders
shipped to the United Kingdom. The domain is an Orders table. The criteria
argument restricts the resulting set of records to those for which
ShipCountry equals UK.
Dim curX As Currency
curX = DSum("[Freight]", "Orders", "[ShipCountry] = 'UK'")
The next example calculates a total by using two separate criteria. Note
that single quotation marks (') and number signs (#) are included in the
string expression, so that when the strings are concatenated, the string
literal will be enclosed in single quotation marks, and the date will be
enclosed in number signs.
Dim curX As Currency
curX = DSum("[Freight]", "Orders", _
"[ShipCountry] = 'UK' AND [ShippedDate] > #1-1-95#")
DSum("[Quantity]*[UnitPrice]", "Order Details", "[ProductID] = " _
& [ProductID])
When the query is run, Microsoft Access calculates the total amount of sales
for each product, based on information from an Order Details table. The sum
of sales for each product is added to the Products table.
Jeanette Cunningham -- Melbourne Victoria Australia
> Jeanette,
> I couldn't get that to work, but I tried DSum in the following way:
[quoted text clipped - 90 lines]
>> >> > Thanks in Advance,
>> >> > Paul