Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2004
    Posts
    364

    Unanswered: Problems changing a listbox rowsource via a Combobox selection

    Hello, I am struggling to find the correct method to make a listbox rowsource change when a combo box is set to either yes or no.

    I can make the listbox show the rowsource if the combobox is "No", but when it is set to "Yes" the listbox remains blank.

    I have the code below in the form onCurrent event, and combobox AfterUpdate event -
    Code:
    Dim strSourceYes As String
    Dim strSourceNo As String
    Dim StrCombo As String
    
    StrCombo = Me.combo104.Text
    
    If StrCombo = "Yes" Then
    strSource = "SELECT tblVisits.visitID, tblVisits.time_in, tblVisits.time_out, tblVisits.date FROM tblVisits;"
    Me.List3.RowSource = strSourceYes
    Me.List3.Requery
    
    Else
    
    If StrCombo = "No" Then
    Me.GroupID = Null
    strSourceNo = "SELECT tblparticipants.participantID, tblparticipants.first_name, tblparticipants.last_name FROM tblparticipants;"
    Me.List3.RowSource = strSourceNo
    Me.List3.Requery
    
    End If
    End If
    What am I doing wrong? Any help would be greatfully recieved! Thankyou.

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    If

    StrCombo = "Yes"

    Shouldn't
    Code:
    strSource = "SELECT tblVisits.visitID, tblVisits.time_in, tblVisits.time_out, tblVisits.date FROM tblVisits;"
    Me.List3.RowSource = strSourceYes
    be
    Code:
    strSourceYes = "SELECT tblVisits.visitID, tblVisits.time_in, tblVisits.time_out, tblVisits.date FROM tblVisits;"
    Me.List3.RowSource = strSourceYes
    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Aug 2004
    Posts
    364
    Thankyou! My oversight, I think my eyes have gone after starting at that code for an hour or so!

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Glad we could help!

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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