missprogrammer
Programmer
sorry, should of been more detailed. I am pasting my results of several recordsets into excel using vba. My thing is I wont know how may records exist in each recordset. So I can I find the last used cell or fist empty cell.
AccessIsFun (Programmer) Nov 19, 2001
You could count the recordsets before you paste them. Then set your next starting point at RecordCount (of the first rescordset) + 2 (Excel starts at one, and if you're putting headers in, then you'll need to account for 2 spaces to make sure that you don't overlap).
Obviously adjusting for your next recordsets e.g. Starting point 3 = RecordCount1 + RecordCount2 + 1 et cetera
Dim RecCnt as Integer, rst as RecordSet
Set rst = CurrentdB.OpenRecordset ("[TableName]"
RecCnt = rst.RecordCount
Hope this helps
Kyle
AccessIsFun (Programmer) Nov 19, 2001
You could count the recordsets before you paste them. Then set your next starting point at RecordCount (of the first rescordset) + 2 (Excel starts at one, and if you're putting headers in, then you'll need to account for 2 spaces to make sure that you don't overlap).
Obviously adjusting for your next recordsets e.g. Starting point 3 = RecordCount1 + RecordCount2 + 1 et cetera
Dim RecCnt as Integer, rst as RecordSet
Set rst = CurrentdB.OpenRecordset ("[TableName]"
RecCnt = rst.RecordCount
Hope this helps
Kyle