PC Review


Reply
Thread Tools Rate Thread

Applyfilter issue

 
 
Sailor
Guest
Posts: n/a
 
      9th Jul 2008
Using the following code, I want to apply a filter to an open form to lookup
a value entered by the operator in the header of the form:

Dim CNUM As Long

On Error GoTo errh1

If IsNull([CMPNum]) Or [CMPNum] = "" Then
Exit Sub
End If
CNUM = [CMPNum]

DoCmd.ApplyFilter "CMP-Action lookup filter", "[Complaint_Number] = " & CNUM

The saved filter is a query containing 4 tables, one of which has the field
Complaint_Number defined. When the ApplyFilter code executes, it displays a
message box "Enter parameter value" asking for the Complaint_Number.

Why is the message box appearing?

Thanks for your help!

Sailor
 
Reply With Quote
 
 
 
 
Alex Dybenko
Guest
Posts: n/a
 
      9th Jul 2008
Hi,
try to use:
me.Filter= "[Complaint_Number] = " & CNUM
me.FilterOn=true

instead of DoCmd.ApplyFilter

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com

"Sailor" <(E-Mail Removed)> wrote in message
news:EF01E0E3-19CB-4D87-8779-(E-Mail Removed)...
> Using the following code, I want to apply a filter to an open form to
> lookup
> a value entered by the operator in the header of the form:
>
> Dim CNUM As Long
>
> On Error GoTo errh1
>
> If IsNull([CMPNum]) Or [CMPNum] = "" Then
> Exit Sub
> End If
> CNUM = [CMPNum]
>
> DoCmd.ApplyFilter "CMP-Action lookup filter", "[Complaint_Number] = " &
> CNUM
>
> The saved filter is a query containing 4 tables, one of which has the
> field
> Complaint_Number defined. When the ApplyFilter code executes, it displays
> a
> message box "Enter parameter value" asking for the Complaint_Number.
>
> Why is the message box appearing?
>
> Thanks for your help!
>
> Sailor


 
Reply With Quote
 
Sailor
Guest
Posts: n/a
 
      9th Jul 2008
Thanks for the prompt reply.

Me.Filter results in "Invalid Use of Property" message at compile with the
work Filter highlighted. Could there be a problem with the references?

Sailor

"Alex Dybenko" wrote:

> Hi,
> try to use:
> me.Filter= "[Complaint_Number] = " & CNUM
> me.FilterOn=true
>
> instead of DoCmd.ApplyFilter
>
> --
> Best regards,
> ___________
> Alex Dybenko (MVP)
> http://accessblog.net
> http://www.PointLtd.com
>
> "Sailor" <(E-Mail Removed)> wrote in message
> news:EF01E0E3-19CB-4D87-8779-(E-Mail Removed)...
> > Using the following code, I want to apply a filter to an open form to
> > lookup
> > a value entered by the operator in the header of the form:
> >
> > Dim CNUM As Long
> >
> > On Error GoTo errh1
> >
> > If IsNull([CMPNum]) Or [CMPNum] = "" Then
> > Exit Sub
> > End If
> > CNUM = [CMPNum]
> >
> > DoCmd.ApplyFilter "CMP-Action lookup filter", "[Complaint_Number] = " &
> > CNUM
> >
> > The saved filter is a query containing 4 tables, one of which has the
> > field
> > Complaint_Number defined. When the ApplyFilter code executes, it displays
> > a
> > message box "Enter parameter value" asking for the Complaint_Number.
> >
> > Why is the message box appearing?
> >
> > Thanks for your help!
> >
> > Sailor

>
>

 
Reply With Quote
 
Alex Dybenko
Guest
Posts: n/a
 
      10th Jul 2008
Hi,
yes, this quite strange error. Try to comment out these lines and then
compile the project, perhaps there is some other error as well. And of
course check that all references in place

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com

"Sailor" <(E-Mail Removed)> wrote in message
news:0336F0EC-91C5-4B6C-8128-(E-Mail Removed)...
> Thanks for the prompt reply.
>
> Me.Filter results in "Invalid Use of Property" message at compile with the
> work Filter highlighted. Could there be a problem with the references?
>
> Sailor
>
> "Alex Dybenko" wrote:
>
>> Hi,
>> try to use:
>> me.Filter= "[Complaint_Number] = " & CNUM
>> me.FilterOn=true
>>
>> instead of DoCmd.ApplyFilter
>>
>> --
>> Best regards,
>> ___________
>> Alex Dybenko (MVP)
>> http://accessblog.net
>> http://www.PointLtd.com
>>
>> "Sailor" <(E-Mail Removed)> wrote in message
>> news:EF01E0E3-19CB-4D87-8779-(E-Mail Removed)...
>> > Using the following code, I want to apply a filter to an open form to
>> > lookup
>> > a value entered by the operator in the header of the form:
>> >
>> > Dim CNUM As Long
>> >
>> > On Error GoTo errh1
>> >
>> > If IsNull([CMPNum]) Or [CMPNum] = "" Then
>> > Exit Sub
>> > End If
>> > CNUM = [CMPNum]
>> >
>> > DoCmd.ApplyFilter "CMP-Action lookup filter", "[Complaint_Number] = "
>> > &
>> > CNUM
>> >
>> > The saved filter is a query containing 4 tables, one of which has the
>> > field
>> > Complaint_Number defined. When the ApplyFilter code executes, it
>> > displays
>> > a
>> > message box "Enter parameter value" asking for the Complaint_Number.
>> >
>> > Why is the message box appearing?
>> >
>> > Thanks for your help!
>> >
>> > Sailor

>>
>>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
applyFilter =?Utf-8?B?RmlsZW1ha2VyUHJvX0RldmVsb3Blcg==?= Microsoft Access Form Coding 1 1st Feb 2007 12:25 AM
RE: ApplyFilter =?Utf-8?B?TWF1cmljaW8gU2lsdmE=?= Microsoft Access Form Coding 0 28th Mar 2006 07:58 PM
ApplyFilter Barry Shadduck Microsoft Access VBA Modules 3 6th Aug 2004 06:59 PM
ApplyFilter? Gary Microsoft Access Form Coding 0 8th Jan 2004 04:31 AM
ApplyFilter Gina Liddle Microsoft Access Getting Started 1 25th Sep 2003 09:25 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:44 PM.