|
-
Sep 15th, 2004, 08:24 AM
#1
Thread Starter
Junior Member
ComboBox Problem
Hi!
I have 2 ComboBox in Excel which I fill with ID and Name from a DB, see below:
Private Sub Workbook_Open()
szSQL = "SELECT PROJECT_ID, NAME " & _
"FROM PROJECT "
Set rsData = New ADODB.Recordset
rsData.Open szSQL, oCn1, adOpenForwardOnly, adLockReadOnly, adCmdText
If Not rsData.EOF Then
Do While Not rsData.EOF
ProjID = rsData.Fields(0).Value
Name = rsData.Fields(1).Value
Sheet2.ComboBox1.AddItem ProjID
Sheet2.ComboBox2.AddItem Name
rsData.MoveNext
Loop
Else
MsgBox "Error: No records returned. ", vbCritical
End If
rsData.Close
End Sub
What I want to do is that when I choose the ProjID in ComboBox1, I want that ProjID's Name to be activated automatic in Combobox2.
Does anyone have an idea how to to that?
/B
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|