PC Review


Reply
Thread Tools Rate Thread

Recordset.filter error

 
 
Jim Z.
Guest
Posts: n/a
 
      16th Apr 2004
I have a VBA Event code which executes when a form loads.
It attempts to limit a recordset of all employees to a
particular employee.

When it runs, I receive an run time error 2001 "You
already canceled this step". The VBEditor
highlights "Me.FilterOn = True".

When I pull up the Properties within the VB Editor, it
appears the default FilterOn is False. Any suggestions?

Me.RecordSource = "QryEmployeeID"
Me.Filter = "EmployeeID = 3"
Me.FilterOn = True

Thanks.
 
Reply With Quote
 
 
 
 
Tony C
Guest
Posts: n/a
 
      16th Apr 2004
Rather than using VBA code to critique the data, why not
use a Select Query?

1. Create your Query listing the fields you want to
display.
2. In the Query EmployeeID field, set the criteria to
something like "Like Forms![MasterForm]![EmployeeID]" (do
not include the inverted commas!!!).
3. Name the Query "FilteredEmployeeDetails".
4. On the Form that you are trying to control the filter
on, remove the VBA Code that you have featured, then set
the Data Source to "FilteredEmployeeDetails".

This suggestion is based on the assumption that you are
trying to display records based on another Forms current
Record!!

HTH


Tony C.
>-----Original Message-----
>I have a VBA Event code which executes when a form loads.
>It attempts to limit a recordset of all employees to a
>particular employee.
>
>When it runs, I receive an run time error 2001 "You
>already canceled this step". The VBEditor
>highlights "Me.FilterOn = True".
>
>When I pull up the Properties within the VB Editor, it
>appears the default FilterOn is False. Any suggestions?
>
>Me.RecordSource = "QryEmployeeID"
>Me.Filter = "EmployeeID = 3"
>Me.FilterOn = True
>
>Thanks.
>.
>

 
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
ADO Recordset as Form's Data Source - Removing a Filter Raises Error rm Microsoft Access Form Coding 3 3rd Jul 2008 05:26 PM
Filter of Datasheet (disconnected ADO recordset) error Corey-g via AccessMonster.com Microsoft Access Form Coding 2 13th Sep 2006 11:29 PM
Filter ADO Recordset Error ufgator1978@yahoo.com Microsoft VB .NET 1 24th Aug 2005 11:42 AM
Filter recordset error Gwy Microsoft Access VBA Modules 2 22nd Nov 2004 12:45 PM
Filter recordset error Gwy Microsoft Access 2 22nd Nov 2004 12:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:42 PM.