Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jun 2004
    Location
    L, Schleswig-Holstein, Germany
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Apply filter-criteria to forms using buttons? (Ac

    Mornin'

    Ok this might be rather easy but I just can't do it. My table looks like this

    tblTest
    Name
    Street
    Test (yes/no)

    Now how do I open a form with criteria YES set, so that only records with YES will be shown. Doing that with a query is fairly easy but I'd have to use 2 forms then (one for all YES and one for all records) - this can be done much nicer...

    Hope this little information helps you to help me. Basically I have a menu and want to let the user choose what criteria should apply to the form he's going to open.

    Greetings
    moon

  2. #2
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Apply filter-criteria to forms using buttons? (Ac

    a command button that opens the form , sets the form filter property to "test= -1" and then filter = true, and another command button that just opens the form. If you need more info post back.

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

    Re: Apply filter-criteria to forms using buttons? (Ac

    As an alternative to Zave's reply, you could create a form with an option group and a command button.
    The option group contains three option buttons, labeled "Yes", "No" and "Both", with option values 1, 2 and 3, respectively. You can create the option group using the wizard, if you like.
    The On Click code for the command button looks like this:

    Private Sub cmdOpenForm_Click()
    Dim strWhere As String
    Select Case Me.grpOptions
    Case 1 ' Yes
    strWhere = "Test = True"
    Case 2 ' No
    strWhere = "Test = False"
    Case 3 ' Both
    strWhere = ""
    End Select
    DoCmd.OpenForm FormName:="frmMyForm", WhereCondition:=strWhere
    End Sub

    where cmdOpenForm is the name of the command button, grpOptions is the name of the option group, and frmMyForm is the name of the form to be opened.

  4. #4
    2 Star Lounger
    Join Date
    Jun 2004
    Location
    L, Schleswig-Holstein, Germany
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Apply filter-criteria to forms using buttons?

    guys you are just great! Thanks a lot!

    I think I just needed an example how to do it.

Posting Permissions

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