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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
ACC2000: changing report .Filter does not work
I'm still working on issues in earlier threads. When I use code to
change my report's .Filter and set .FilterOn to true, I get no records. When I manually go to the report design, change the .Filter and ..FilterOn, I also get no records. Here's the code I use to change .Filter via code: sWhere = "[cus_no] = '" & sCustnum & "'" DoCmd.OpenReport sReportname, acViewDesign ' Must come before "set rpt" Set rpt = Reports(sReportname) rpt.Filter = sWhere rpt.FilterOn = True DoCmd.Close , , acSaveYes DoEvents ' Allow Access to save report. What's wrong? Why is Access ignoring the .Filter property even though .FilterOn is True (or Yes in the property box). |
#2
|
|||
|
|||
ACC2000: changing report .Filter does not work
Why are you doing this the hard way. Why not just use
sWhere = "[cus_no] = '" & sCustnum & "'" Docmd.OpenReport sReportName,acViewPreview,,strWhere -- John Spencer Access MVP 2002-2005, 2007-2008 Center for Health Program Development and Management University of Maryland Baltimore County .. "A Man" wrote in message . net... I'm still working on issues in earlier threads. When I use code to change my report's .Filter and set .FilterOn to true, I get no records. When I manually go to the report design, change the .Filter and .FilterOn, I also get no records. Here's the code I use to change .Filter via code: sWhere = "[cus_no] = '" & sCustnum & "'" DoCmd.OpenReport sReportname, acViewDesign ' Must come before "set rpt" Set rpt = Reports(sReportname) rpt.Filter = sWhere rpt.FilterOn = True DoCmd.Close , , acSaveYes DoEvents ' Allow Access to save report. What's wrong? Why is Access ignoring the .Filter property even though .FilterOn is True (or Yes in the property box). |
#3
|
|||
|
|||
ACC2000: changing report .Filter does not work
|
#4
|
|||
|
|||
ACC2000: changing report .Filter does not work
As a side note, when I go to the report in design mode, I enter this for
the .Filter: [cus_no] = '000000080000' That is a valid field name and customer number. I double checked both. But I still get no records when I do a report preview. FilterOn is Yes in the Properties window. In the Help, About box the version says "Access 2000 (9.0.2720)". I don't see a service pack listed, do I need one to resolve a report filter bug? I'm having a similar problem as posted on 11/13/07 to this same newsgroup. The .Filter property forces the report to return no records. Thanks. |
Thread Tools | |
Display Modes | |
|
|