|
-
Apr 12th, 2004, 02:54 PM
#1
Thread Starter
Addicted Member
collection comparison not working...
I have 2 tables, the one holds all data for the horses that have been enrolled in an incentive program.
The other holds data for every horse.
Now I have them both opened, but only the horses that are in the first table can be selected, so i only want those inserted into a listview box...
This is the code i have so far.
VB Code:
Dim strId As Collection, strX As String
Set strId = New Collection
strX = "1"
x = 1
Do Until rcdTable2.EOF
strId.Add rcdTable2(0), strX
x = x + 1
strX = x
rcdTable2.MoveNext
Loop
intX = Int(strX)
rcdTable2.Close
Do Until rcdTable1.EOF
strInsert = nonulls(rcdTable1(0))
On Error Resume Next
strId.Item (strInsert)
If Err.Number = 0 Then
Set lsiItem = frmMain.lsvEnrollHorse.ListItems.Add(, , strInsert)
For k = 1 To 14
strInsert = nonulls(rcdTable1(k))
lsiItem.ListSubItems.Add , , strInsert
Next k
End If
rcdTable1.MoveNext
Loop
now the problem is this..
if i dont' enter any number at all, it grabs all the records in the first table, holding all those enrolled in the incentive program.
But when it loops through the other table holding all horse info, it only finds a dozen or so numbers.. where there is 270+ in the incentive program, and 500+ horses.
So what am I doing wrong?
I think that the comparison i'm using the wrong syntax.
--> strId.Item (strInsert)
now strInsert is the index of the item, but i need to check every item.. do i have to do a for z to strId.Count loop???
Last edited by myrrdan; Apr 12th, 2004 at 02:59 PM.
Oooops.....theres another semi-colon in the wrong spot....
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
|