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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array Syntas Help...

Status
Not open for further replies.

sanders720

Programmer
Aug 2, 2001
421
US
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)) <> &quot;&quot; Then
Debug.Print .Fields(A(q))
CRASHES HERE --->> Me.cboITJobNo.AddItem .Fields(A(q))
End If
.MoveNext
Next q2
.Close
End With
Next q
 
Maybe if you said something like
dim A(1 to 20) as variant
instead of
dim A as variant
 
Now it can't assign A to an array...

A = Array(&quot;[IT Job Number]&quot;, &quot;Vendor&quot;, &quot;[Invoice Number]&quot;, &quot;[Requesting User]&quot;, &quot;[Authorizing User]&quot;, &quot;[Purchase Date]&quot;, _
&quot;[Warranty End Date]&quot;, &quot;[Product Manufacturer]&quot;, &quot;[Product Name]&quot;, &quot;[Product Part Number]&quot;, &quot;[Product Serial Number]&quot;, _
&quot;[CD Key]&quot;, &quot;[Upgrade Flag]&quot;, &quot;Quantity&quot;, &quot;[Seats Covered]&quot;, &quot;[User Assignment]&quot;, &quot;[Installed PC Name]&quot;, _
&quot;[Product License Number]&quot;, &quot;[Purchase Price]&quot;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top