|
-
Jul 18th, 2006, 06:21 PM
#1
Thread Starter
Lively Member
Load second combo box
This code works for first combo box. How would I populate the second box on the form load? Thanks!
Private Sub Form_Load()
Dim lrs As ADODB.Recordset
Set m_con = New ADODB.Connection
Call m_con.Open("DRIVER={SQL Server};SERVER=(LOCAL);UID=Cust;PWD=aaa")
If m_con.State = adStateOpen Then
Set lrs = New ADODB.Recordset
Set lrs.ActiveConnection = m_con
lrs.CursorLocation = adUseClient
lrs.CursorType = adOpenStatic
Call lrs.Open("SELECT * FROM Talk..ProgramsOffered")
Call LoadCombo(cmbProgram, lrs, "ProgramName", "ProgramKeyField")
If cmbProgram.ListCount > 0 Then
cmbProgram.ListIndex = 0
End If
End If
Second ComboBox Info:
Call lrs2.Open("SELECT * FROM Talk.._UserName ORDER BY SortSeq")
Call LoadCombo(cmbUserName, lrs2, "UserName", "UserNameKey")
If cmbUserName.ListCount > 0 Then
cmbProgram.ListIndex = 0
End If
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
|