report

G

Guest

I have a report that I am importing into a already made excel workbook.
However when I export it each field is on a new row, I need it every other
row. Is this possiable?

Thanks
Chey
 
G

Guest

what does that mean? I tried doing unbound fields under it. I tired text
boxes under it. Nothing worked.
Chey
 
A

Arvin Meyer [MVP]

Apparently, I read it incorrectly. You said each field is a new row? Did you
mean field? If that's the case, simply add an empty field in between each
existing field.

If, in fact you need to actually separate each row with an empty row, then
you simply write a row, then skip, then another row, etc. Something like
(aircode):

Dim xlApp As Excel.Application
Dim xlSheet As Excel.Worksheet
Dim rst As DAO.Recordset
Dim db As DAO.Database
Dim Rnum As Integer

Set db = CurrentDb
Set rst = db.OpenRecordset("Your Query", dbOpenSnapshot)
ctr = rst.RecordCount * 2

Set xlApp = New Excel.Application
With xlApp
.Visible = True
.Workbooks.Add
Set xlSheet = .Worksheets(1)
End With
With xlSheet
Rnum = 1
Do Until rst.EOF
.Cells(1, Rnum).Value = rst!Field1
.Cells(2, Rnum).Value = rst!Field2
.Cells(3, Rnum).Value = rst!Field3
.Cells(4, Rnum).Value = rst!Field4
.Cells(5, Rnum).Value = rst!Field5
.Cells(6, Rnum).Value = rst!Field6
rst.MoveNext
Rnum = Rnum + 2
Loop
.SaveAs "C:\TEST.xls"
End With
xlApp.Quit

Set xlSheet = Nothing
Set xlApp = Nothing
Set db = Nothing
rst.Close
Set rst = Nothing
--
Arvin Meyer, MCP, MVP
Free MS-Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 

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

Similar Threads

Form Close 7
Exporting into Excel 2
clear text 1
sort 3
Date Order 18
Question Box 2
sum in a report 1
Filter 2

Top