Results 1 to 4 of 4
  1. #1
    dada is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    40

    filter value in a combo box


    good day to all! here is the scene, i have a two combo box namely, comboFrom and comboTo.. they have the same values coming from a table named tblMonth. so it would be like, January, February, ...... December.. what i want to do is when i select February on my comboFrom, the values that can be selected only in the comboTo would be starting on March onwards, since February is the starting date, comboTo will only have March - December selection.. i hope i made it clear.. and Thanks in advance!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What is the RowSource of your ComboBoxTo?

  3. #3
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    I this is what I have done. i have a table with the names on the month and a ID column.

    name of my Table= tblMonth
    it has two fields= {ID, mnth}

    I have two combox on my form one Combo0 the Other Combo2.

    In the Combo0 after Update event I use this code:

    Private Sub Combo0_AfterUpdate()
    Dim strSQL As String

    If Me.Combo0 = 12 Then
    strSQL = "Select * from tblmonth Where ID =" & Me.Combo0
    Else
    strSQL = "Select * from tblmonth Where ID >" & Me.Combo0
    End If

    Me.Combo2.RowSource = strSQL
    Me.Combo2.Requery

    End Sub


    attached is a sample. Check Form4

  4. #4
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    This line

    strSQL = "Select * from tblmonth Where ID =" & Me.Combo0

    should be:

    strSQL = "Select * from tblmonth Where ID>0"


    *** Or see attached mdb


    HTH
    ------
    Steve
    --------------------------------
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Combo Box filter – help!
    By catat in forum Forms
    Replies: 1
    Last Post: 08-24-2010, 04:15 PM
  2. Filter my form from combo box
    By Angate in forum Forms
    Replies: 3
    Last Post: 04-24-2010, 01:57 PM
  3. Combo box and filter query
    By thart21 in forum Forms
    Replies: 7
    Last Post: 04-06-2010, 11:37 AM
  4. Combo Box Filter
    By jgelpi in forum Programming
    Replies: 3
    Last Post: 07-27-2009, 12:54 PM
  5. Applying a filter to a combo box
    By bugchaser in forum Programming
    Replies: 1
    Last Post: 02-20-2009, 02:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums