filtering

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • helpmeplease213
    New Member
    • Oct 2007
    • 20

    filtering

    Hello

    I have a Form which has a subform and its source object is a Query.

    Now I also have a option group with three options

    1- All
    2- Sort by date
    3- Sort by unit

    "All" displays all data

    Now when "sort by date" is selected is it possible to then have a textbox which you type in a date and the table is then sorted from the date typed to the current date?

    Also when the option "sort by unit" is selected you then type into a separate text box the unit and all records of the unit are displayed.

    Thanks
  • JustJim
    Recognized Expert Contributor
    • May 2007
    • 407

    #2
    Originally posted by helpmeplease213
    Hello

    I have a Form which has a subform and its source object is a Query.

    Now I also have a option group with three options

    1- All
    2- Sort by date
    3- Sort by unit

    "All" displays all data

    Now when "sort by date" is selected is it possible to then have a textbox which you type in a date and the table is then sorted from the date typed to the current date?

    Also when the option "sort by unit" is selected you then type into a separate text box the unit and all records of the unit are displayed.

    Thanks
    Hi,
    I think that you are possibly confusing "sorting" with "filtering" . Is it the case that if you click

    2-Sort by date

    then you only want records with that date (or possibly later) and that if you click

    3-Sort by unit

    you only want records that match that type of unit?

    Anyway, to get you started, put your two textboxes on the form and set their visible property to no.

    In the After update event put the following code
    (Air Code Warning - This code is just of the top of my head.)
    [CODE=vb]Private Sub OptionGroupName _AfterUpdate()
    Select Case Me.OptionGroupN ame
    Case 2
    Me.TextBoxDate. Visible = True
    Me.TextBoxUnit. Visible = False
    Case 3
    Me.TextBoxUnit. Visible = True
    Me.TextBoxDate. Visible = False
    Case Else
    ' Stuff you need for Sort/Filter All
    End Select[/CODE]
    Good luck

    Jim

    Comment

    Working...