its close, but I don't need a collection. Here is exactly what I am trying to
do.
I have 5 Visit buttons on my form labelled Visit 1, Visit 2, etc. When the
user chooses a visit, the number gets stored in a text box. So they choose
Visit 2, the number 2 gets stored in a textbox.
Once they click any visit button, a Visit for opens and On Open I am doing
the following:
I am setting the declared integer VisitNo = to the text box, so 2 in this
case.
I have 5 VisitFlags, declared as integers, named VisitFlag1, VisitFlag2, etc.
I have a control form where the user decides which visits they want certain
info showing on the actual Visit form by clicking a check box for which visit
they want.
I open a recordset of the control form to see which visit the user chose.
In my recordset I do something like this:
If fld.Name = "Visi2" Then
If fld.Value = False Then
Else
VisitFlag2 = 2
End If
End If
So then, from the If statement above, I will be able to see if VisitFlag2 = 0,
meaning it wasn't chosen in the control form, or it equals 2, meaning it was
chosen.
So now I need to see if the VisitNo, which is at 2 because they clicked the
Visit 2 button, equals the Visit2Flag but I can't just use the word
Visit2Flag because there are 5 Flags, I just want to say something like:
If VisitNo = VisitFlag & VisitNo Then
blah blah
meaning:
If 2 = (the value of VisitFlag2)
Hope this helps!
Thanks for everyones help!
Kipp said:
If I grasp what you are trying to do, then I would recommend that you put
your integers into a collection, in the order that you want to access them.
So, the code might look like:
' Instance your collection
Dim cVisitFlags As New Collection
Dim iCollectionIndex As Integer
Dim iVisitNo As Integer
' Add integers to your collection
cVisitFlags.Add 123
cVisitFlags.Add 234
cVisitFlags.Add 345
cVisitFlags.Add 456
cVisitFlags.Add 567
cVisitFlags.Add 678
cVisitFlags.Add 789
cVisitFlags.Add 890
cVisitFlags.Add 901
cVisitFlags.Add 120
' Now loop for the count of the collection.
For iCollectionIndex = 1 To cVisitFlags.Count
' Do indexed read into your collection
If VisitNo = cVisitFlag(iCollectionIndex) Then
' blah, blah, blah
End If
Next
Hi there,
I have an IF statement that I need to use some concatenation with.
[quoted text clipped - 11 lines]
I keep getting a type mismatch. Anyone see where I went wrong?
Thanks for your help!