Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

listbox help

VidsVids Member Posts: 1
Hi, Hope that I am in the right place for help? if not could you please forward this on for me.

I have a text box linked to field called "Category", in a database and I need the list to be displayed in a listbox and also to update itself as I am adding new records in VB.

Please help I have checked the Messageboard but the answer's are archived off.

Thanx (sorry, I am a newbie to VB)

Vids

Comments

  • toeswrtoeswr Member Posts: 6
    Private Sub Form_Initialize()
    List1.Clear
    Dim l As Long
    l = Data1.Recordset.RecordCount
    Data1.Recordset.MoveFirst
    While Data1.Recordset.EOF() = False
    List1.AddItem Data1.Recordset.Fields(0)
    Data1.Recordset.MoveNext
    Wend

    end sub
    ----
    Private Sub save_Click()
    Data1.Recordset.Fields(0) = Text1.Text
    List1.AddItem Text1.Text
    Data1.Recordset.Update
    End Sub
    ----
    Private Sub addnew_Click()
    Data1.Recordset.AddNew
    End Sub



Sign In or Register to comment.