FROM EMAIL:
>Thanks for that prompt answer but he code stops on
>Set rs = db.openrecordset("QrySelectDepartment"

>Runtime error 3061
>To few parameters, expected 1.
>The Query works when run manually
>Any ideas, by the way I added DAO 3.6 Object Library, is that right
The problem is your query needs parameters to run. When calling a parameter query as a recordset, you have to pass the parameters explictly, even if they are linked to an open form.
I've made the appropriate changes to the code, but you will need to modify them where necessary to match your needs:
Dim objXL as Object
Dim xlWB as Object
Dim xlWS as Object
'some objects to refer to Excel
Dim db as DAO.Database
Dim rs as DAO.Recordset
Dim fld as DAO.Field
Dim qd as DAO.QueryDef
Dim prm as DAO.Parameter
'Our db references.
Dim x as Integer
'Just a counter
set db=currentdb
set qd=db.querydefs("QrySelectDepartment"
'If your parameters are linked to fields on forms (eg Forms!frmDepartment!txtDept) then you can use:
'for each prm in qd.Parameters
' prm.value=eval(prm.name)
'next prm
'otherwise you have to pass them individually
qd.parameters("Enter Department Name"
'The parameter name is what you have typed in the query builder
set rs=qd.OpenRecordset
'open our recordset
if rs.eof and rs.bof then exit sub
'if there are no records, then there's no point carrying on.
set objXL=createobject("Excel.Application"

set xlwb=objxl.workbooks.open("PathTo\Workbook.xls"

set xlws=xlwb.worksheets("Summary"

'set references to our excel worksheet
with xlws
.range("A3"

.select
do until rs.eof
for x=0 to 2
.ActiveCell.Offset(0,x)=rs(x)
'copy each field into the cells
next x
.ActiveCell.Offset(1,0).select
'move down a row on spreadsheet
rs.movenext
'get next record
loop
end with
xlwb.save
xlwb.close
objxl.close
set xlws=nothing
set xlwb=nothing
set objxl=nothing
rs.close
set rs=nothing
set db=nothing
'tidy up time
----------------------------------------
Ben O'Hara
Home: bpo@SickOfSpam.RobotParade.co.uk
Work: bo104@SickOfSpam.westyorkshire.pnn.police.uk
(in case you've not worked it out get rid of Sick Of Spam to mail me!)
Web:
----------------------------------------