sanders720
Programmer
Help..... I'm just trying to seqnentially read through this array. There must be some little thing wrong??? The program crashes at >AddItem below, and none of the debug.rint statements happen.
Thanks in advance for the help!!!
Dim A As Variant
Dim c As Integer
Dim q As Integer
Dim q2 As Integer
Dim sql As String
Dim rs As New ADODB.Recordset
For q = 1 To 20
Debug.Print A(q)
With rs
sql = "SELECT DISTINCT '" & A(q) & "' FROM qrySoftwareTracking"
.Open sql
.MoveLast
c = .RecordCount
.MoveFirst
For q2 = 1 To c
If .Fields(A(q)) <> "" Then
Debug.Print .Fields(A(q))
CRASHES HERE --->> Me.cboITJobNo.AddItem .Fields(A(q))
End If
.MoveNext
Next q2
.Close
End With
Next q
Thanks in advance for the help!!!
Dim A As Variant
Dim c As Integer
Dim q As Integer
Dim q2 As Integer
Dim sql As String
Dim rs As New ADODB.Recordset
For q = 1 To 20
Debug.Print A(q)
With rs
sql = "SELECT DISTINCT '" & A(q) & "' FROM qrySoftwareTracking"
.Open sql
.MoveLast
c = .RecordCount
.MoveFirst
For q2 = 1 To c
If .Fields(A(q)) <> "" Then
Debug.Print .Fields(A(q))
CRASHES HERE --->> Me.cboITJobNo.AddItem .Fields(A(q))
End If
.MoveNext
Next q2
.Close
End With
Next q