DSum Where program in filter

G

geebee

Hi,

I have a report generated by the following: Users select
programs from a multiselect [programvalue] field. A
dynamic SQL statement is generated:


DoCmd.OpenForm "graphs for Monthly Travel Report
Summary", acNormal, "", "", , acHidden
'DoCmd.OpenReport "Allocation/Obligation/Expenditures
Summary", acPreview, "", ""
Dim varselected As Variant
Dim strSQL As String
For Each varselected In Me.programvalue.ItemsSelected
strSQL = strSQL & "'" & Me.programvalue.ItemData
(varselected) & "',"
Next varselected
If strSQL <> "" Then
strSQL = "[Program] IN (" & Left(strSQL, Len
(strSQL) - 0) & ")"

DoCmd.OpenReport "Allocation/Obligation/Expenditures
Summary", acPreview, , strSQL
Me.Visible = False
'test:
strSQL = ""
'end test


The report mostly contains fields with DOmain Aggregate
functions like the following:

=DLookUp("[Allocation]","Program","[Obligation] =
[Programs]")

I would like to include a field at the top of the report
(or at the bottom) which sums all the allocation amounts
for the programs in the strSQL (query). How can I do
this?


Thank sin advance,
geebee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top