Prev: Hyperlink created in Access does not function when printed to pdf
Next: Adding control to report
From: TheDrescher on 17 May 2010 12:25 I'm currently running a report to pull retention data for a certain time period in my database. The current code I use is: Dim strWhere As String Dim stDocName As String stDocName = "RetentionReport" strWhere = "[Date] >= #" & _ Forms!CountsReportMenu![FromDate] & "# And [Date] <=#" & _ Forms!CountsReportMenu![ToDate] & "# " DoCmd.OpenReport stDocName, acPreview, , strWhere In addition to the date range I'd like to add a line that says to only pull records where the RetentionEffort field = Yes. Is there a way to add this in without me messing up my date coding? Thanks!
From: Marshall Barton on 17 May 2010 12:51 TheDrescher wrote: >I'm currently running a report to pull retention data for a certain time >period in my database. The current code I use is: >Dim strWhere As String > Dim stDocName As String > stDocName = "RetentionReport" > strWhere = "[Date] >= #" & _ > Forms!CountsReportMenu![FromDate] & "# And [Date] <=#" & _ > Forms!CountsReportMenu![ToDate] & "# " > > DoCmd.OpenReport stDocName, acPreview, , strWhere > >In addition to the date range I'd like to add a line that says to only pull >records where the RetentionEffort field = Yes. Is there a way to add this in >without me messing up my date coding? strWhere = "[Date] >= #" & _ Forms!CountsReportMenu![FromDate] & "# And [Date] <=#" & _ Forms!CountsReportMenu![ToDate] & "# " _ & " And RetentionEffort" But, if RetentionEffort is a Text field (instead of a Yes/No field), the the last line would be: & " And RetentionEffort = 'Yes' " -- Marsh MVP [MS Access]
|
Pages: 1 Prev: Hyperlink created in Access does not function when printed to pdf Next: Adding control to report |