• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

If statement...help me understand

Set rs = db.OpenRecordset(strQuery)
If (rs.RecordCount > 0) Then
cnt = 1
For Each fld In rs.Fields
wks.Cells(1, cnt).Value = fld.Name
cnt = cnt + 1
Next fld
Call rng.CopyFromRecordset(rs, 4000, 26)
End If
 
Establish a dataset.
If there's at least 1 record, then we'll do something.
start a counter.
For every field (akak column) within the dataset's fields, set the cell value to the field name.
Increment the counter.
Next field.

Call another macro. Guessing that it copies the info.


In summary, looks like this copies over the field headings and then copies over the actual data.
 
Back
Top