Group:  Microsoft Access ยป microsoft.public.access.reports
Thread: Problems With Filter Syntax

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Problems With Filter Syntax
Debra Ann 28.09.2006 12:00:01
I have the following code but I am doing something wrong with the "if
me.fitler" part of the statemenet since it always comes up with the label New
Activities Report even when it is an Internal Reference. What is wrong with
the syntax?

If Me.Filter = "([Type] = 'IR')" Then
Me.lblHeading.Caption = "Internal References"
Else
Me.lblHeading.Caption = "New Activities Report"
End If

Thanks
--
Debra Ann
RE: Problems With Filter Syntax
Debra Ann 28.09.2006 12:31:02
I should add that I am testing this in an expression placed in the reports
"On Open". The report is openning from a macro that is filtering the report.
It seems the filter information does not get placed in the filter command
until after so the me.filter = "" when I am testing it. What should I use to
test it after it opens and places a filter on?
--
Debra Ann


"Debra Ann" wrote:

[Quoted Text]
> I have the following code but I am doing something wrong with the "if
> me.fitler" part of the statemenet since it always comes up with the label New
> Activities Report even when it is an Internal Reference. What is wrong with
> the syntax?
>
> If Me.Filter = "([Type] = 'IR')" Then
> Me.lblHeading.Caption = "Internal References"
> Else
> Me.lblHeading.Caption = "New Activities Report"
> End If
>
> Thanks
> --
> Debra Ann
Re: Problems With Filter Syntax
"John Spencer" <spencer[ at ]chpdm.edu> 28.09.2006 12:32:02
Perhaps Me.Filter isn't what you think it is. It is possible that the
apostrophes got changed to quotation marks, or that the Parentheses are not
there, or ...

Try adding a debug.print statement, msgbox, or setting a break point on the
code to check the value.

Msgbox "The Filter is " & me.Filter

If Me.Filter = "([Type] = 'IR')" Then
Me.lblHeading.Caption = "Internal References"
Else
Me.lblHeading.Caption = "New Activities Report"
End If


"Debra Ann" <DebraAnn[ at ]discussions.microsoft.com> wrote in message
news:3419CBA4-CACF-4F80-A0C5-A32C0FBF7B31[ at ]microsoft.com...
[Quoted Text]
>I have the following code but I am doing something wrong with the "if
> me.fitler" part of the statemenet since it always comes up with the label
> New
> Activities Report even when it is an Internal Reference. What is wrong
> with
> the syntax?
>
> If Me.Filter = "([Type] = 'IR')" Then
> Me.lblHeading.Caption = "Internal References"
> Else
> Me.lblHeading.Caption = "New Activities Report"
> End If
>
> Thanks
> --
> Debra Ann


Re: Problems With Filter Syntax
Debra Ann 28.09.2006 12:49:01
John,

I did make a break point and found out that it contains nothing. Maybe I
need to do this another way. Let me give you more detail.

I have a report that is opening by a macro. The macro opens the report and
sets the filter. I want to change either a text box or a label caption in my
title to say "Internal References". What can I use in the macro after the
report opens to tell it to place the title in the label? I tried SetValue
but that didn't work. I don't know what else I can do. I have about fifteen
macros that open the report and need different titles depending on each macro.

Any help would be greatly appreciated as I have spent too much time of
trying to figure this one out.

Thanks John,

Debra Ann
--
Debra Ann


"John Spencer" wrote:

[Quoted Text]
> Perhaps Me.Filter isn't what you think it is. It is possible that the
> apostrophes got changed to quotation marks, or that the Parentheses are not
> there, or ...
>
> Try adding a debug.print statement, msgbox, or setting a break point on the
> code to check the value.
>
> Msgbox "The Filter is " & me.Filter
>
> If Me.Filter = "([Type] = 'IR')" Then
> Me.lblHeading.Caption = "Internal References"
> Else
> Me.lblHeading.Caption = "New Activities Report"
> End If
>
>
> "Debra Ann" <DebraAnn[ at ]discussions.microsoft.com> wrote in message
> news:3419CBA4-CACF-4F80-A0C5-A32C0FBF7B31[ at ]microsoft.com...
> >I have the following code but I am doing something wrong with the "if
> > me.fitler" part of the statemenet since it always comes up with the label
> > New
> > Activities Report even when it is an Internal Reference. What is wrong
> > with
> > the syntax?
> >
> > If Me.Filter = "([Type] = 'IR')" Then
> > Me.lblHeading.Caption = "Internal References"
> > Else
> > Me.lblHeading.Caption = "New Activities Report"
> > End If
> >
> > Thanks
> > --
> > Debra Ann
>
>
>
Re: Problems With Filter Syntax
"John Spencer" <spencer[ at ]chpdm.edu> 28.09.2006 15:56:21
WHERE are you executing the code? Which event of the report? It could be
as simple as you need to move your code to a different event.

Perhaps the format event of the relevant section - the section that contains
the control lblHeading,


"Debra Ann" <DebraAnn[ at ]discussions.microsoft.com> wrote in message
news:BE576559-EEB2-4DF2-830E-AD75E0D421D8[ at ]microsoft.com...
[Quoted Text]
> John,
>
> I did make a break point and found out that it contains nothing. Maybe I
> need to do this another way. Let me give you more detail.
>
> I have a report that is opening by a macro. The macro opens the report
> and
> sets the filter. I want to change either a text box or a label caption in
> my
> title to say "Internal References". What can I use in the macro after the
> report opens to tell it to place the title in the label? I tried SetValue
> but that didn't work. I don't know what else I can do. I have about
> fifteen
> macros that open the report and need different titles depending on each
> macro.
>
> Any help would be greatly appreciated as I have spent too much time of
> trying to figure this one out.
>
> Thanks John,
>
> Debra Ann
> --
> Debra Ann
>
>
> "John Spencer" wrote:
>
>> Perhaps Me.Filter isn't what you think it is. It is possible that the
>> apostrophes got changed to quotation marks, or that the Parentheses are
>> not
>> there, or ...
>>
>> Try adding a debug.print statement, msgbox, or setting a break point on
>> the
>> code to check the value.
>>
>> Msgbox "The Filter is " & me.Filter
>>
>> If Me.Filter = "([Type] = 'IR')" Then
>> Me.lblHeading.Caption = "Internal References"
>> Else
>> Me.lblHeading.Caption = "New Activities Report"
>> End If
>>
>>
>> "Debra Ann" <DebraAnn[ at ]discussions.microsoft.com> wrote in message
>> news:3419CBA4-CACF-4F80-A0C5-A32C0FBF7B31[ at ]microsoft.com...
>> >I have the following code but I am doing something wrong with the "if
>> > me.fitler" part of the statemenet since it always comes up with the
>> > label
>> > New
>> > Activities Report even when it is an Internal Reference. What is wrong
>> > with
>> > the syntax?
>> >
>> > If Me.Filter = "([Type] = 'IR')" Then
>> > Me.lblHeading.Caption = "Internal References"
>> > Else
>> > Me.lblHeading.Caption = "New Activities Report"
>> > End If
>> >
>> > Thanks
>> > --
>> > Debra Ann
>>
>>
>>


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net