Copy a table from Access into 2 columns

T

Tran Hong Quang

Hi,
I have a big tables in Ms Access. I writ a VBA code from Ms Access to
output these records to Ms Excel. I am using:

..Range("B1").CopyFromRecordset rstTelBill

Each record is on one row of Excel. How can I copy records into 2 columns
like this:

Record1 Record2
Record3 Record4
............ ............

Thank for help
Tran Hong Quang
 
T

Tim Williams

probably not the most efficient (maybe check out GetRows and cycle through
the resulting array) but something like this .

Untested

Tim.

'*******************************
dim r as range, b as boolean

set r = .Range("B1").
b=false

do while not rstTelBill.eof

r.value= rstTelBill(0).value

if b then
set r=r.offset(1,-1)
else
set r=r.offset(0,1)
end if
b=not b


rstTelBill.movenext
loop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top