Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2006
    Posts
    157

    Unanswered: Match value with combo

    Hi:
    I try to match values with combo. Values are match but i dont know how to set the combo with the match value. I ask the same question before for ListBox and this method works with that. But when i try to use the same with combo this wont allow me to set it according to the match value.

    Error:
    Combo128.Selected(i) = True

    -----------------------------------------------
    Dim AccIDs(3)
    qry1 = "select ID from selaccnt"
    Set rst1 = CurrentDb.OpenRecordset(qry1)
    If rst1.EOF = False Then
    t = 0
    rst1.MoveFirst
    Do Until rst1.EOF
    AccIDs(t) = rst1!Id
    t = t + 1
    rst1.MoveNext
    Loop
    End If

    t = 0
    Me.Combo128.RowSource = "SELECT LastValidTech.AccountID FROM LastValidTech WHERE (((LastValidTech.TicketNum)=[Forms]![" & Me.Parent.Name & "]![ticketnum]));"
    With Me.Combo128
    For i = 0 To Combo128.ListCount
    If CStr(AccIDs(t)) = Combo128.ItemData(i) Then
    Combo128.Selected(i) = True
    t = t + 1
    End If
    Next
    End With

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    That's because combos use a different method to set values ... Try:

    Combo.value= XXXX

    And form the looks of it, you're gonna need to revisit your lookup and population scheme ...
    Back to Access ... ADO is not the way to go for speed ...

Posting Permissions

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