outputting values from table to excel.

steve_bris

Registered User.
Local time
Today, 11:52
Joined
Mar 22, 2005
Messages
30
Hi.

I have a table in my database called Roles, and I have a column called RoleID which is the primary key for the table.

I would like to print the different Roles listed in this column to column A of an excel sheet.

How would I go about this in VBA ?

Thanks heaps for any help.

Steve
 
In Access help in the VBE window, type in transferspreadsheet.
If you play with that a bit, you will get a feel for it's ins and outs.
You can run it against a table or a query, so you can tailor the output.
 
Thanks Sargeant......I figured it out with

Set rRoles = d.OpenRecordset("Roles")
intRolRow = 1
Do
Sheets("Sheet1").Select
Range("J" & intRolRow) = rRoles("roleID")
rRoles.MoveNext
intRolRow = intRolRow + 1
Loop Until rRoles.EOF

Thanks for the help :)
 
Cool. You know you don't have to select things prior to performing actions...

Set rRoles = d.OpenRecordset("Roles")
intRolRow = 1
Do
Sheets("Sheet1").Range("J" & intRolRow) = rRoles("roleID")
rRoles.MoveNext
intRolRow = intRolRow + 1
Loop Until rRoles.EOF
 
Oh really.......that helps me in a lot of other areas of my code to :)

Thanks :)

Steve
 

Users who are viewing this thread

Back
Top Bottom