Thank you for your code, I just have a small question here: How do I define the column in the query to make my loop recognize it?
right now I have the code like below:
Code:
Dim AreaArray()
Dim i As Long
Dim j As Long
Dim tdf As DAO.TableDef
Dim NumFld As Long
Dim RecordCnt As Long
Set db = CurrentDb()
Set tdf = db.TableDefs(AreaQuery1)
NumFld = tdf.Fields.Count
RecordCnt = DCount("*", "AreaQuery1")
For i = 4 To NumFld
For j = 0 To RecordCnt
ReDim AreaArray(i, j)
rs.MoveFirst
Do While Not rs.EOF
AreaArray() = "SELECT [SmallArea] From [AreaQuery1] WHERE ([SmallArea]<>'NA');" (Here is the column I want to use to this loop)
Set rs = db.OpenRecordset(AreaArray(), dbOpenSnapshot)
If rs.RecordCount > 0 Then
AreaArray() = "Update [AreaQuery2]SET[AreaQuery2].[SmallArea]=" & Sql1 & "WHERE [AreaQuery1].[AreaCode]=[AreaQuery2].[AreaCode];"
db.Execute AreaArray(), dbfilonerror
End If
rs.Close
Next i
Next j
my concern is while the loop finish [SmallArea] column, it won't recognize the next column, can you give me little help here? Thanks!

Originally Posted by
alcapps
rst.movefirst if rst.recordcount > 0 do while not rst.eof
Your code goes here in the loop..of recordset rst.moveNext loop end if rst.close