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  

strWhere criteria



 
 
Thread Tools Display Modes
  #1  
Old March 25th, 2010, 03:06 PM posted to microsoft.public.access.reports
Maarkr
external usenet poster
 
Posts: 240
Default strWhere criteria

Let's see how this goes over...I don't think it can be done.
I am filtering a report with multiple filters (6). The switch and report
runs fine using a strWhere variable that combines the strWhere clauses that
the user selects, like
strWhere = strWhere & " AND Priority = '" & Me.CmboPri & "'"

My challenge is to add criteria from a joined table that contains comments,
with the print filter (combo row source) being '1 -Show only Standards with
Comments;2 -Show only Standards without Comments'

this is the SQL from what I want to show for the ones without comments:
SELECT tblStandards.STD_No
FROM tblStandards LEFT JOIN tblXComments ON tblStandards.STD_No =
tblXComments.StdNo
WHERE (((tblXComments.Cmt_ID) Is Null));

so, I need a where clause to add to the list of strWhere that will allow me
to filter the comments. The report source query is complex and I can't add
in the joined comments table to it without screwing up the report data.
  #2  
Old March 25th, 2010, 04:12 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default strWhere criteria

Maarkr wrote:

Let's see how this goes over...I don't think it can be done.
I am filtering a report with multiple filters (6). The switch and report
runs fine using a strWhere variable that combines the strWhere clauses that
the user selects, like
strWhere = strWhere & " AND Priority = '" & Me.CmboPri & "'"

My challenge is to add criteria from a joined table that contains comments,
with the print filter (combo row source) being '1 -Show only Standards with
Comments;2 -Show only Standards without Comments'

this is the SQL from what I want to show for the ones without comments:
SELECT tblStandards.STD_No
FROM tblStandards LEFT JOIN tblXComments ON tblStandards.STD_No =
tblXComments.StdNo
WHERE (((tblXComments.Cmt_ID) Is Null));

so, I need a where clause to add to the list of strWhere that will allow me
to filter the comments. The report source query is complex and I can't add
in the joined comments table to it without screwing up the report data.



Presumably, the report's record source query includes the
STD_No field. If so, then you can change the report's
recource to your query above, but changing it to use your
complicated query unstead of tblStandards.

--
Marsh
MVP [MS Access]
  #3  
Old March 25th, 2010, 04:51 PM posted to microsoft.public.access.reports
Duane Hookom
external usenet poster
 
Posts: 7,177
Default strWhere criteria

If the field(s) you want to use to filter your report aren't in the report's
record source query then you can't include them in the strWhere as used in
DoCmd.OpenReport.

I would either hard-code form/control references in a saved query or
dynamically build the SQL of a saved query that can be used for filtering.

--
Duane Hookom
Microsoft Access MVP


"Maarkr" wrote:

Let's see how this goes over...I don't think it can be done.
I am filtering a report with multiple filters (6). The switch and report
runs fine using a strWhere variable that combines the strWhere clauses that
the user selects, like
strWhere = strWhere & " AND Priority = '" & Me.CmboPri & "'"

My challenge is to add criteria from a joined table that contains comments,
with the print filter (combo row source) being '1 -Show only Standards with
Comments;2 -Show only Standards without Comments'

this is the SQL from what I want to show for the ones without comments:
SELECT tblStandards.STD_No
FROM tblStandards LEFT JOIN tblXComments ON tblStandards.STD_No =
tblXComments.StdNo
WHERE (((tblXComments.Cmt_ID) Is Null));

so, I need a where clause to add to the list of strWhere that will allow me
to filter the comments. The report source query is complex and I can't add
in the joined comments table to it without screwing up the report data.

 




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 09:58 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.