A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

adding another control



 
 
Thread Tools Display Modes
  #1  
Old May 17th, 2010, 05:25 PM posted to microsoft.public.access.reports
TheDrescher
external usenet poster
 
Posts: 16
Default adding another control

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!
  #2  
Old May 17th, 2010, 05:51 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default adding another control

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]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:16 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.