That code should be on a form, not a report.
Yes, you can change the report name and condition and run it anywhere.
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!)
"Scot Dever" <ScotDever[ at ]discussions.microsoft.com> wrote in message news:DB589587-6A3A-44A1-AD7F-A40C7A5C43D7[ at ]microsoft.com...
[Quoted Text] > Thank You Doug, Quick follow up. Can I insert this code into ay report, > changing the report name and where condition appropriately of coarse > > "Scot Dever" wrote: > >> I am trying to create a simple user defined report form for a range of >> records between a chosen start and end date but keep getting this compile >> and >> syntax error instead of the report, am I missing something? >> >> Private Sub Command4_Click() >> >> Dim ReportName >> ReportName = "Stores Start Order" _ >> DoCmd.OpenReport _ >> ReportName:=ReportName, _ >> view:=acViewPreview, _ >> WhereCondition:="[StartConstCur]between #"& _ >> Me.StartDate& "# and #" & _ >> Me.EndDAte & "#" >> >> End Sub >>
|