export form current record source

  • Thread starter Thread starter chriske911
  • Start date Start date
C

chriske911

how can I refer to a form's current record source as rercordset to
export to a excel sheet or whatever?
I want to use the form's recordset with all of the filters applied as
is
so I cannot point to a query with parameters as I do not know what
filters are used

I have tried to use me.recordsetclone but it gives me an error:
"An expression you entered is the wrong data type for one of the
arguments."

thnx
 
chriske911 said:
how can I refer to a form's current record source as rercordset to
export to a excel sheet or whatever?
I want to use the form's recordset with all of the filters applied as
is
so I cannot point to a query with parameters as I do not know what
filters are used

I have tried to use me.recordsetclone but it gives me an error:
"An expression you entered is the wrong data type for one of the
arguments."

The OutputTo method can be called to export the active object, as for
example:

DoCmd.OutputTo _
acOutputForm, _
, _
acFormatXLS, _
"C:\Temp\" & Me.Name & ".xls"
 
Dirk Goldgar expressed precisely :
The OutputTo method can be called to export the active object, as for
example:
DoCmd.OutputTo _
acOutputForm, _
, _
acFormatXLS, _
"C:\Temp\" & Me.Name & ".xls"

I get exactly the same error message this way

this is my code:

DoCmd.OutputTo acOutputForm, Form_frmEstHDR, acFormatXLS, FileName

filename is a variable that is pointing to a UNC path where the user's
documents reside

thnx
 
chriske911 said:
Dirk Goldgar expressed precisely :



I get exactly the same error message this way

this is my code:

DoCmd.OutputTo acOutputForm, Form_frmEstHDR, acFormatXLS, FileName

No, that's wrong. In the first place, if a value is supplied for the
second argument of the OutputTo method, is should be a string that gives
the name of the object, not a reference to the object itself. In the
second place, to export the active object you must not specify *any*
second argument. See the example I posted. Try this:

DoCmd.OutputTo acOutputForm, , acFormatXLS, FileName
 
Dirk Goldgar pretended :
No, that's wrong. In the first place, if a value is supplied for the
second argument of the OutputTo method, is should be a string that gives
the name of the object, not a reference to the object itself. In the
second place, to export the active object you must not specify *any*
second argument. See the example I posted. Try this:
DoCmd.OutputTo acOutputForm, , acFormatXLS, FileName

yep, that was it
did try that before though, but the strange thing I have had before
that it isn't working in debug mode but it did in user mode

thnx
 

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


Back
Top