Results 1 to 6 of 6

Thread: Selecting from a DataList control within coding?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Location
    Melbourne
    Posts
    7

    Question

    With the standard Listbox or the Combox controls, it is possible to manually select an item from within list using the ListIndex function.

    List1.ListIndex = 1 (or whatever other number).

    However, the DataList and the DBList controls seem to lack this function. Is there another way to do it? TIA.

  2. #2
    Borry
    Guest
    Hi Frosty,


    did you find any solution for this ?

    I'm looking for exactly the same thing.

    Thanks in advance,


    Bjorn

  3. #3
    Frenzied Member oh1mie's Avatar
    Join Date
    Sep 2001
    Location
    Finland
    Posts
    1,043
    You can use DataList1.BoundText for that

    If you bounding Id (like id=123)
    DataList1.BoundText=123

    Code:
    Db.Execute "delete * from mytable where id=" & Val(DataList1.BoundText)
    oh1mie/Vic


  4. #4
    Borry
    Guest
    but I don't want to delete it or so .... I just want that the first item in the data list is selected.

    Thanks in advance !

  5. #5
    Frenzied Member oh1mie's Avatar
    Join Date
    Sep 2001
    Location
    Finland
    Posts
    1,043
    Originally posted by Borry
    but I don't want to delete it or so .... I just want that the first item in the data list is selected.

    Thanks in advance !
    Code:
    "select * from mytable where id=" & Val(DataList1.BoundText)
    oh1mie/Vic


  6. #6
    Frenzied Member oh1mie's Avatar
    Join Date
    Sep 2001
    Location
    Finland
    Posts
    1,043
    Code:
    Private Sub Form_Activate()
        Screen.MousePointer = vbDefault
        If Not Data2.Recordset.EOF Then
           DataList1.BoundText = Data2.Recordset!Id
           DataList1_Click
        End If
    End Sub
    oh1mie/Vic


Posting Permissions

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



Click Here to Expand Forum to Full Width