-----Original Message-----
Thanks for that
I have used the Option Explicit declaratiuon and declared
rstSLA as a recordset.
I am still having problems when I get to the last line of
this code (DoCmd)
SQLtext = "SELECT [Link Table].SLA_Main, [Link
Table].SLA_Name, etc"
Set rstSLA = dbsData.OpenRecordset(SQLtext) ' ,
dbOpenDynaset)
DoCmd.TransferSpreadsheet acExport,
8, "rstSLA", "C:\data\temp1.xls"
Is this the right method to use?? The error message I
get is that the Jet engine could not find the
object 'rstSLA'
-----Original Message-----
you are creating an object by inferrence:
your "set rstSLA =" statement creates an instance of a recordset
"dim rstSLA as recordset"
would be the explicit dimensioning of the recordset you then add records to using:
set rstSLA = dbsData.OpenRecordset(SQLtext, dbOpenDynaset)
Use 'Option Explicit' in the code header instead
of 'option compare db' to force the identification of all
variables explicitly
This can help you to understand where you are using
system variables or local ones you are creating
----- Michael wrote: -----
Thanks for that
I am just unclear. I select the recordset using a string
that makes a SQL ststement as per the following
SQLtext = "SELECT [Link Table].SLA_Main, etc"
Set rstSLA = dbsData.OpenRecordset(SQLtext, dbOpenDynaset)
Does this create a query?
If it does how do you refer to it in the export to Excel
Thanks again for your help
Cheers
Michael
-----Original Message-----
How do you create the Recordset in the first place?
If your Recordset is based on a Query, then you can
simply
export the Query to an Excel file. The Excel
file
should
then have the rows of the Query / Recordset.
HTH
Van T. Dinh
MVP (Access)
-----Original Message-----
This is probably very basic, but I would appreciate any
advice. I have created a recordset which is a
selection
of records based on user input. I now want to save
that
recordset as an excel file. I thought the best was to
do
this was to first save the recordset as as one
of
my
Access tables and then export it to excel. However I
cannot find a way of saving the recordset. I would have
thought it was a relatively straight forward function.
If anyone knows how to do this I would be
grateful
.