TBotNik 0 Newbie Poster

All,

All the help & HOWTOs say you can get subtotal from groupings and grand totals with the use of:

=sum([fieldname])

and I have used this in the past, but current report is erroring by giving the popup, asking for value entry on each of these I placed in the report.

I'm guessing this is a reference or config problem at the Access or Office level.

Does anyone know what is causing this and how to correct it?

Anyway I used the expression builder and pulled it directly from the current report form, so know syntax is not the issue.

So found and followed HOWTO at:

http://office.microsoft.com/en-us/ac...224441033.aspx

and had encountered some problems setting date fields on the report, which I resolved with HOTOW at:

How to assign values to Unbound Text box in Report thru VBA code ? - bytes

using the function set of:

=myfunction()

which worked fine.

Wondering if I have to also do this in the same manner, so looked up help on DSUM, but was not able to make it work right, because that tends to pull sum for entire report, not by the grouping section.

Here is the code I have in the report so far:

Option Compare Database
Public SubTot
Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
'    SBTasn = CliSbT([tboxCLI])
    Call CliSbT([tboxCLI])
'    Me![tboxSBT].ControlSource = CliSbT([tboxCLI])
'    Me![tboxSBT].Requery
End Sub
Private Sub GroupFooter1_Print(Cancel As Integer, PrintCount As Integer)
'    Call CliSbT([tboxCLI])
End Sub
Private Sub Report_Open(Cancel As Integer)
End Sub
Function BegDate() As Date
    BegDate = FrmSDate
End Function
Function EndDate() As Date
    EndDate = FrmEDate
End Function
Function SBTasn() As Date
    SBTasn = CliSbT([tboxCLI])
End Function
Function CliSbT(myClient)
    Dim FMTbeg, FMTend, WHRstr
    FMTbeg = DateSerial(Year(FrmSDate), Month(FrmSDate), Day(FrmSDate))
    FMTend = DateSerial(Year(FrmEDate), Month(FrmEDate), Day(FrmEDate))
    WHRstr = "(([tmp_cnm] = '" & myClient & "')) AND " & _
             "((([tmp_wdt] >= #" & FMTbeg & "# AND [tmp_wdt] <= #" & FMTend & "#)) OR " & _
             "(([tmp_ted] >= #" & FMTbeg & "#) AND ([tmp_ted] <= #" & FMTend & "#)))"
    SubTot = DSum("[tmp_bhr]*[tmp_wir]", "tmpREPfnr", WHRstr)
End Function
Function GrndTot()
'    GrndTot DSum("[tmp_bhr]*[tmp_wir]", "tmpREPfnr",)
End Function

The function I'm working on for the subtotal by client is "CliSbT". Put break on the "End Function" line to check the values and got the right values for each section, but not geting correctly assigned in report so was getting "#Name?" instead, now getting just "0.00".

Any ideas on my dilemma?

TBNK

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.