Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Thanked 0 Times in 0 Posts

    cleanup filters in the code

    cleaning up filters in the code

    I have a good function which is the base of further actions in my database.This function processes the subfrom called FSubudate on the main form called FOrderInformation.
    I want to clear all the filters after i have chosen one of the two possibilities,but the filter sticks on,and remains even i have put the command FilterOn = False
    For example, if i work with invoices, the filter paymentid >0 remains obstructs my works with
    the orders, where the filter should be paymentid = 0.
    Is there any possibility to make my code more flexible and clean up the filter after each chosen event? I have to close the from and open it again in order to get rid of the filters.So my questions is can i work say with the first option,say invoices and then immediately work
    with the second option, say orders?I have hear of a command Nothing, but i am not sure how to use it.
    My code is the following
    Public Function OrderOrInvoice()
    Dim intAnswer As String
    Dim f As Form
    Set f = Forms!FOrderInformation![FSubupdate].Form
    'naming controls
    Dim paymentid As Control
    Dim invoicedate As Control
    Dim customersub As Control
    Dim orderid As Control
    Dim orderdate As Control
    Dim datei As Control
    'setting controls
    Set invoicedate = f![invoicedate]
    Set paymentid = f![paymentid]
    Set customersub = f![customersub]
    Set orderid = f![orderid]
    Set orderdate = f![orderdate]
    'setting labels
    Set invoice = Forms!FOrderInformation![invoice]
    Set datei = Forms!FOrderInformation![datei]

    ' ======================
    ' invoice processing '*******************************************
    intAnswer = MsgBox(" orders? ", vbQuestion + vbYesNo)
    If intAnswer = vbNo Then
    ' look up invoices
    f.Visible = True
    f.FilterOn = True
    f.Filter = "paymentid >0"
    paymentid.ColumnHidden = 0
    invoicedate.ColumnHidden = 0
    customersub.ColumnHidden = 0
    orderdate.ColumnHidden = -1
    orderid.ColumnHidden = -1
    orderdate.ColumnHidden = -1
    datei.Visible = True
    f.FilterOn = False

    ' orders processing
    ' '*******************************************
    ElseIf intAnswer = True Then
    f.Visible = True
    f.FilterOn = True
    f.Filter = "paymentid=0"
    paymentid.ColumnHidden = -1
    invoicedate.ColumnHidden = -1
    orderid.ColumnHidden = 0
    orderdate.ColumnHidden = 0
    customersub.ColumnHidden = 0
    datei.Visible = True
    f.FilterOn = False
    End If
    End Function

  2. #2
    5 Star Lounger
    Join Date
    May 2001
    Patterson Lakes, Melbourne, Victoria, Australia
    Thanked 0 Times in 0 Posts

    Re: cleanup filters in the code

    You wouldn

Posting Permissions

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