Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking for correct syntax to populate 30 combo boxes

Status
Not open for further replies.

vamoose

Programmer
Oct 16, 2005
320
MX
Using the below listed code to attempt to populate 30 combo boxes on form frmStart within Access 2000 VBA. Combo box names are numbered 1 thru 30 as are the Testers I am doing the search for. How do I correctly populate Combo box 1 with the results of the search for line on Tester 1.

Private Sub Form_Open(Cancel As Integer)

Dim stDocName, stLinkCriteria, SQLa As String: Dim T As Integer: T = 0
Dim cn As ADODB.Connection: Dim rs As ADODB.Recordset
Again:
T = T + 1
SQLa = "SELECT Line FROM VPD.dbo.vpd where Tester= " & T
Set cn = New ADODB.Connection: cn.Open "driver={SQL Server};" & _
"server=172.16.6.172;database=coilspec;uid=dtuttle;password=mpmadmin"
Set rs = cn.Execute(SQLa, , adCmdText)
[Forms]![frmStart]!T = rs.Fields("Line")
If (rs.EOF) Then rs.Close: cn.Close: Set rs = Nothing: Set cn = Nothing: DoCmd.Close: Exit Sub
GoTo Again:
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top