Hi all,
I would like some help with this problem.
I have a lot of fields in a table that have the same beginning text name followed by a number, for example some fields may be "Field1" "Field2" ... "Field25" ... etc.
I am pulling in a lot of data from another database, so to make life easier I wanted to use a Do Loop Until so that I wont need to repeat the same coding steps for each field number, "Field1" "Field2" ... "Field25" ... etc.
Here's something similar to what I tried
Code:
Dim count As Number
Dim i As Number
Dim str As String
Dim countStr As String
Dim rs As DAO.Recordset
Set rs = db.OpenRecordset("Record Set Table", dbOpenDynaset)
i = 0
count = 1
Do
countStr = count
str = "Field" + countStr
If IsNull(rs![str]) Then
'Dont copy the text to the new database
'End the Do Loop Until
i = 1
Else
'Copy the text to the new database
'[Code for copying]
'Increment count to get the next field
count = count + 1
End If
Loop Until i = 1
My problem is rs![str] doesn't work. Is there another way where I can use strings or something similar to access the fields in the tables?