Filter values of a Listbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NewtoAccess
    New Member
    • May 2007
    • 32

    Filter values of a Listbox

    Access 2000, regarding forms.

    I want a command BUTTON labeled "server" on a MAINFORM that:
    > Opens up a INVENTORY form-which contains a list box- and
    > Filter the values in the LIST BOX (for ex. shows only a list of server pcs and not entire inventory)

    Once working I would add other buttons on MAINFORM which would open up INVENTORY form and filter based on other values.

    Is this possible? let me know, Thanks
  • abolos
    New Member
    • Apr 2007
    • 65

    #2
    Originally posted by NewtoAccess
    Access 2000, regarding forms.

    I want a command BUTTON labeled "server" on a MAINFORM that:
    > Opens up a INVENTORY form-which contains a list box- and
    > Filter the values in the LIST BOX (for ex. shows only a list of server pcs and not entire inventory)

    Once working I would add other buttons on MAINFORM which would open up INVENTORY form and filter based on other values.

    Is this possible? let me know, Thanks

    You may use:
    SELECT [tblNameAge].[stname] FROM tblNameAge WHERE stAge=18;

    Comment

    • NewtoAccess
      New Member
      • May 2007
      • 32

      #3
      Originally posted by abolos
      You may use:
      SELECT [tblNameAge].[stname] FROM tblNameAge WHERE stAge=18;

      Not sure where I should put that code. Here is what I have, Not using a listbox:
      Private Sub SwitchorRaritan _Click()
      On Error GoTo Err_SwitchorRar itan_Click

      Dim stDocName As String
      Dim stLinkCriteria As String

      stDocName = "deviceselectio nZ"

      stLinkCriteria = [Category]='switch'or [Category]='raritan' "
      DoCmd.OpenForm stDocName, , , stLinkCriteria

      Exit_SwitchorRa ritan_Click:
      Exit Sub

      Err_SwitchorRar itan_Click:
      MsgBox Err.Description
      Resume Exit_SwitchorRa ritan_Click

      End Sub

      Comment

      • abolos
        New Member
        • Apr 2007
        • 65

        #4
        Originally posted by NewtoAccess
        Not sure where I should put that code. Here is what I have, Not using a listbox:
        Private Sub SwitchorRaritan _Click()
        On Error GoTo Err_SwitchorRar itan_Click

        Dim stDocName As String
        Dim stLinkCriteria As String

        stDocName = "deviceselectio nZ"

        stLinkCriteria = [Category]='switch'or [Category]='raritan' "
        DoCmd.OpenForm stDocName, , , stLinkCriteria

        Exit_SwitchorRa ritan_Click:
        Exit Sub

        Err_SwitchorRar itan_Click:
        MsgBox Err.Description
        Resume Exit_SwitchorRa ritan_Click

        End Sub

        You have to put it in a query in the SQL view.

        Comment

        Working...