G
Guest
I attempted to reference a field in a recordset by using a string, but the
field is not being recognized. The field name is a string b/c the code is
within a do...loop statement where it goes through a series of fields within
the same record that have the names 'Sub1Code', 'Sub2Code', etc. Here is
what I have:
Dim intSub, strSubCodeField, strSubAns, varSubCode
Do Until intSub = 15
intSub = intSub + 1
strSubCodeField = "Sub" & intSub & "Code"
strSubAns = "SubAns" & intSub
'''the next line is where I am having the problem...
varSubCode = rsMESubInfo!strSubCodeField
If varSubCode = "" Then
Exit Do
End If
''' (it does more stuff after this, but I can't get past this point)
Loop
I tried to Dim/Set a field object, which didn't work...I may have done
something wrong. Any ideas? Thanks in advance!
field is not being recognized. The field name is a string b/c the code is
within a do...loop statement where it goes through a series of fields within
the same record that have the names 'Sub1Code', 'Sub2Code', etc. Here is
what I have:
Dim intSub, strSubCodeField, strSubAns, varSubCode
Do Until intSub = 15
intSub = intSub + 1
strSubCodeField = "Sub" & intSub & "Code"
strSubAns = "SubAns" & intSub
'''the next line is where I am having the problem...
varSubCode = rsMESubInfo!strSubCodeField
If varSubCode = "" Then
Exit Do
End If
''' (it does more stuff after this, but I can't get past this point)
Loop
I tried to Dim/Set a field object, which didn't work...I may have done
something wrong. Any ideas? Thanks in advance!