VB combobox advice - TechRepublic
Question
July 24, 2010 at 01:47 PM
dillon.damien

VB combobox advice

by dillon.damien . Updated 15 years, 11 months ago

I have set up a movie quote website which populates with the primary keys from a table in an access database (movie table).

So the combobox lists all the movieID’s I have in my table. When I save to my “movie quote” table it saves the corresponding movieID to that table. This works from the databases perspective but clearly not good for a user as they will not know which ID corresponds to which movie in the combobox.

Could anyone recommend a way that I could display the movie name in the combo but have the corresponding movie ID saved to the database when selected. This has become a bit of a road block for me.

The code I use to populate the combobox is below.

[CODE]Public Sub PopulateComboBox()

cboMovie.Items.Clear()

Dim i As Integer, strMovieID As String

For i = 1 To objDS.Tables(“Movies”).Rows.Count
strMovieID = objDS.Tables(“Movies”).Rows(i – 1).Item(“MovieID”)

cboMovie.Items.Add(strMovieID)

Next

End Sub[/CODE]

I would appreciate any help or ideas.

Thanks!

This discussion is locked

All Comments