I have inherited an application that has a button on a form that is supposed to read through a series of fields and if it finds a match, return the value in a matching field.
doc and doc2 are dim’ed above this piece of code. I need to get a count from a field and using that index walk through a seperate field, comparing the value to a string. If the string matches, I then need to get the value in a different field using the same index.
Two problems are occuring. The first is that the IF statement is not finding the value “2” even though it is using the string doc.Group1(0) where 1 is the index. The second is that I am not sure how to redim the array if I get more than 1 hit - which is what I have been told is the actual problem.
Subject: RE: Help with reading / retrieving from arrays
Close. I rewrote it slightly and now have an issue with the doc2.Technician(x-1) = Item2.text line.
For X = 1 To Ubound( doc.Technician )
xstring = Trim(Str(x))
If doc.hasitem("Group" + xstring) Then
Set Item = doc.GetFirstItem("Group" + xstring)
If Item.Text = "2" Then
Set Item2 = doc.GetFirstItem("Tech" + xstring)
doc2.Technician(x-1) = Item2.text
End If
End If
Next
Subject: RE: Help with reading / retrieving from arrays
Basically you can’t write to a filed in that way. What you’ll have to do is create an array first and then write the array to the field after the loop:
dim technicianarray(ubound(doc.technician)) as string