Create a Command Button (RunRep)
& Create this [Event Procedure], you can use the wizard to generate the
"raw" command if you like
note that I use military format for the dates, US will also work
Private Sub RunRep_Click()
Dim strLinkCriteria As String
strLinkCriteria = "MyToWhomFld='" & Me.ToWhomCtl.Value & "'" & _
" MydateFld BetWeen" &
Format(Me.StartDateCtl.Value, "\#yyyy-mm-dd\#") & _
" AND " & Format(Me.EndDateCtl.Value,
"\#yyyy-mm-dd\#")
DoCmd.OpenReoprt "MyRep", acViewPreview,
WhereCondition:=strLinkCriteria
End Sub
HtH
Pieter
williamr said:
I have a form where I ask 3 questions, who the report is for, the start
date
and the stop date. I would like to write code to filter a report for
that
data. Can someone show me how?