Consulting

Results 1 to 3 of 3

Thread: Solved: Recordest Filter

  1. #1
    VBAX Newbie
    Joined
    Jun 2008
    Posts
    4
    Location

    Solved: Recordest Filter

    Hi,

    I have a problem with filtering my Database.
    The thing is I need to filter against the range (counterparty IDs), which is located in a different page. For that purpose I activate that worksheet, and then the fun begins.

    My code looks something like this:

    Worksheets("CnptyNames").Activate
    rst.Filter = "COUNTERPARTYCODE >= " & Range("e4") & "and COUNTERPARTYCODE <=" & Range("e26")

    Here is the message I get:
    "Run-time error "3001": Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another."


    Any help will be very much appreciated.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Is it simply a lack of a space before the AND?

    [vba]

    rst.Filter = "COUNTERPARTYCODE >= " & Range("E4").Value & " AND " & _
    "COUNTERPARTYCODE <=" & Range("E26").Value
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Newbie
    Joined
    Jun 2008
    Posts
    4
    Location
    xld,

    Thanks a lot!!! it works perfectly now.
    I was always get lost somewhrere around ampersands and quotes.

Posting Permissions

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