[AccessD] custom sorts/groups in a report

Gustav Brock gustav at cactus.dk
Fri Apr 23 08:28:33 CDT 2004


Hi Susan

> My final solution is to refer to the form value in the query. This time
> around, I hid the report, forcing the user to use the form to open the
> report, but that isn't the best way to do it. Unfortunately, I didn't know
> how to ward off the dread parameter prompt when the user opens the report
> naturally instead of through the form. I've no problem setting a default for
> the sort, but couldn't stop that stupid prompt because it's coming from the
> query. :(

If that was your only problem (of this thread, of course), you could
replace the parameter lookup with a tiny public function performing
the lookup:

<air code>

  Function GetReportWeekday() As Byte

    Const cstrForm    As String = "frmYourForm"
    ' Default first weekday.
    Const cbytWeekday As Byte = vbSunday
    
    Dim bytWeekday    As Byte

    If IsFormOpen(cstrForm) Then
      bytWeekday = Val(Nz(Forms(cstrForm)!txtYourTextbox.Value, vbNullString))
    EndIf
    If bytWeekday = 0 Then
      bytWeekday = cbytWeekday
    Endif

    GetReportWeekday = bytWeekday
    
  End Function

</air code>

/gustav




More information about the AccessD mailing list