Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Location
    Providence, RI
    Posts
    12

    Question Unanswered: Update ControlSource with OnClick event doesn't work, but works with KeyPress?

    Hi all.

    I created a listbox that gets its information from a query that contains name, phone number, etc... and I've hidden the columns that I don't want to see. I created an event procedure that fills unbound text boxes with the hidden info when I click on a name. At the same time, I want to update the control source of two checkboxes to reflect the currently selected name. This is what I tried:

    Private Sub IntrpList_Click()

    Dim row_int
    row_int = Me.IntrpList.ListCount
    For row_int = 0 To Me.IntrpList.ListCount - 1

    Me.HmPhone = Me.IntrpList.Column("3", "row_int")
    Me.WkPhone = Me.IntrpList.Column("4", "row_int")
    Me.Cell = Me.IntrpList.Column(5, "row_int")
    Me.Pager = Me.IntrpList.Column(6, "row_int")
    Me.email = Me.IntrpList.Column(7, "row_int")
    Me.mbl_email = Me.IntrpList.Column(8, "row_int")
    Me.ContPref = Me.IntrpList.Column(9, "row_int")


    If Me.IntrpList.Selected(row_int) = True Then
    Me.Check206.ControlSource = "T" & row_int & "c"
    Me.Check208.ControlSource = "T" & row_int & "d"
    End If

    Next row_int

    End Sub

    Now, I have the exact same code in the KeyPress event handler, and that works fine, but in the Click event handler, the ControlSource won't update. Any ideas???

    Thanks.

  2. #2
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    requery the listbox after the click or repaint the form Not enough here to go by , it is strange that the key event works using the exact code.

  3. #3
    Join Date
    May 2003
    Location
    Providence, RI
    Posts
    12
    Originally posted by axsprog
    requery the listbox after the click or repaint the form Not enough here to go by , it is strange that the key event works using the exact code.
    Thanks for posting. The problem actually just went away at some point - I have no idea why. I could probably replicate it and try to debug it, but I'm glad just to be done with it and move on. If anyone else has this problem, post it here and maybe we can work it out together.

    Thanks again.

Posting Permissions

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