DB Combo Box

I must use a DBCombo box as part of my current project.  I am wanting to select a cutomer's name from the dbc and have the corresponding information from my table be loaded into text boxes.
adgarrisonAsked:
Who is Participating?
 
dabelleiCommented:
Here'S a sample code


Sub fill_fields()
    Data1.RecordSource = "select *from users where usercode = '" & DBCombo1.Text & "'"
    Data1.Refresh
    On Error Resume Next
    Text1.Text = Data1.Recordset.Fields("username")
    Text2.Text = Data1.Recordset.Fields("serveur")
   
End Sub


Private Sub DBCombo1_Change()
    Call fill_fields
   
End Sub

Private Sub DBCombo1_Click(Area As Integer)
    Call fill_fields
End Sub



You need two data control
1 for recordset with information
      Database set to a valid database
      recordsource set to a valid table

1 for the filling of the dbcombo with selection data
      Database set to a valid database
      recordsource set to a valid table
     
1 dbcombo
      rowsource set to data2
      listfields set to a valid field

2 text box


The dbcombo will be fill with the usercode in this case
When the user click on dbcombo the dbcombo will show all user code from database

When an entry is select then the data1 recordset will be set to the record wich contain all fields from the table that correspond to the entry in the dbcombo.

Hope this will be more comprehensive an answer your question.
0
 
dabelleiCommented:
Use a recordset with data control and do a seek or find in your recordset.  Or just do an SQL search when the content of the DBCombox change.
0
 
adgarrisonAuthor Commented:
That does not answer my question at all.  If I do not know how to start on this, it would stand to reason that I would not know what the code would be. Thanks for you help anyway.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.