Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Remove results from the previous command (Accesss 2000)

    I need some help in finding a way to remove the filter from the previous command.
    I open the report from a form where i have option group called Office.Depending on the option
    in the option group,the record source in the report is filtered for this option.
    In the OnOpen event of the report i have :

    Public town As Long
    town = Forms![Form1]![Office]


    In the Where part of the record source ,called Bas,( Me.RecordSource = Bas) i have :
    And ((customers.afid) = " & town & "

    My code works, but only if i try again.For example,if i press the office Number 1on the form,, then i get null.
    If i press the button second time, then i get the results.If i want then to find the results for the office Number 2, then i

    get the results for the office Number 1.I have to press the button 2 seond time, to get the right results.
    Obviously i need to remofe the results in the report from the previous command.
    I tried to write the following in the OnClose event of the report :
    town = ""

    I got the message type mismatch

    Is it possible to get the results in my report from the first time ?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Remove results from the previous command (Accesss 2000)

    There is a much easier way to do this, using the WhereCondition argument of DoCmd.OpenReport. You don't need the condition on customers.afid in bas (the record source of the report) then, or the public variable. Instead, open the report like this:

    DoCmd.OpenReport "NameOfTheReport", acViewPreview, , "Customers.Afid = " & Me.Office

    (Of course, you must replace NameOfTheReport by the actual name of the report.)

  3. #3
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Remove results from the previous command (Accesss 2000)

    Super ! I have seen the benefits and i will apply it right away

    I wish you a nice day

Posting Permissions

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