Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Feb 2002
    Thanked 0 Times in 0 Posts

    Filter problems (Access XP)

    I am having problems with filtered data on forms as follows:
    I am building an Access Project (.adp) front end to a SQL Server (MSDE) database.

    There are several operations I have coded where the user selects some records in a form, and via a menu item runs code to do something such as update some fields or move the selected records to another table. I do this by passing the forms RecordsetClone, SelTop, and SelHeight to a function and processing the selection.

    Problems occur if the user has filtered the form by using 'Filter by Selection', or 'Filter For:' etc. It appears that in such a case, the RecordsetClone I get is an unfiltered set of records but the SelTop and SelHeight relate to the filtered records; therefore I am processing the wrong records.

    I tried to get round it by doing something like:
    If Me.FilterOn Then Rst.Filter = Me.Filter
    This seemed to be working, but I realise now that it is only working sometimes. At other times, execution falls into the error handler, but interrogating the error reveals number = 0, and no description. I think this error might have been caused by the syntax of the filter string [example: ((vsfStockDetail_All.Shape="nr")) ], although it is taken directly from the forms Filter property.

    I know I could make MS Access

  2. #2
    Join Date
    Mar 2002
    St Albans, Hertfordshire, England
    Thanked 0 Times in 0 Posts

    Re: Filter problems (Access XP)


    I think that you were half way there with your check on me.FilterOn - I would add some additional functionality here:

    If me.FilterOn then
    rst.Filter = me.Filter
    me.Filter = ""
    End If

    The reason that I suggest this addition, is that just because the Filter is not active, deosn't mean that the filter property is not populated - to test this, create a simple continuous form, and allow design changes in all views - then apply a filter - bring up the properties window, and look at the Filter line on the Data tab - you'll see that it is populated - if you then click the remove filter option from the menu bar, then the filter is removed (i.e. FilterOn = False), yet the string used for filtering stays the same.

    I think that even though the filterOn is false, your recordsetclone object is picking up on this stored information - either that or I'm as lost as you are, and the 5 minutes spent thinking about this are completely wasted for both of us...

    ...let's hope I'm right then!!

    Kind regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts