Results 1 to 2 of 2
  1. #1
    kawi6rr is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    39

    Setting combobox rowsource value from another combox

    First I know catagory is spelled wrong but that's how its spelled in the DB.

    I have 2 combo boxes, the first is a cbo_catagory the second is cbo_topic. After update of cbo_catagory I want cbo_topic's value to be based off what was selected from cbo_catagory.

    Private Sub cbo_Catagory_AfterUpdate()


    Dim strSQL As String
    strSQL = "SELECT DISTINCT CFS_Export.Topic, CFS_Export.Catagory FROM CFS_Export WHERE CFS_Export.Topic = '" & Me.cbo_Catagory & "'"
    Me.cbo_Topic2.RowSource = strSQL
    Me.cbo_Topic2.Requery
    End Sub

    As of now nothing happens, any help is apprecaited.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    That should work, however, there is no need for the Catagory field in the Topic combobox.

    Could have the Topic2 combobox RowSource as: SELECT DISTINCT Topic FROM CFS_Export WHERE Topic = [cbo_Catagory];

    Then the code only needs: Me.cbo_Topic2.Requery

    Step debug, set a breakpoint, does the code run? Review link at bottom of my post for debugging guidelines.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. combobox rowsource per row on a subform
    By kowalski in forum Access
    Replies: 2
    Last Post: 12-05-2012, 01:49 AM
  2. Wildcard search within ComboBox to control RowSource
    By CaptainKen in forum Programming
    Replies: 22
    Last Post: 05-16-2012, 02:19 PM
  3. Setting font colour within combobox
    By akhlaq768 in forum Forms
    Replies: 1
    Last Post: 02-27-2012, 10:38 AM
  4. combobox rowsource
    By dirkvw in forum Forms
    Replies: 3
    Last Post: 06-20-2011, 05:12 PM
  5. Replies: 1
    Last Post: 11-01-2010, 06:59 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