Roger,
I think I'm closer now...
I converted the macro using transfer text to a module, then put a button on
my form that called another macro that calls the function RunExport().
Now I get a regular error (no error number):
The microsoft office access database engine could not find the object
'test#csv'. Make sure the object exists and that you spell its name and the
path name correctly.
This is still confusing since I am not trying to reference anything. My
path is simply c:\ and the file name is test.csv. There is no test file in
my c:\ - why does it keep wanting to reference a file that doesnt exist yet?
Thanks!
'------------------------------------------------------------
' RunExport
'
'------------------------------------------------------------
Function RunExport()
On Error GoTo RunExport_Err
DoCmd.TransferText acExportDelim, "RTM_export", "Inspection_EXPORT",
"c:\test.csv", True, ""
RunExport_Exit:
Exit Function
RunExport_Err:
MsgBox Error$
Resume RunExport_Exit
End Function
"Roger Carlson" wrote:
> TransferText is a standard action in the macro builder. It's usually the
> very last one on the list. I suggested the steps below because I'm not able
> to see your query, export spec, and so forth. Is RTM_Export the name of your
> export spec? Is Inspection_EXPORT the name of the table/query? Do you
> actually want to export the fieldnames? Assuming these are correct, the
> only other thing I'd try is to add an additional empty parameter at the end:
>
> DoCmd.TransferText acExportDelim, "RTM_Export", "Inspection_EXPORT",
> "c:\test.txt", True, ""
>
>
> --
> --Roger Carlson
> MS Access MVP
> Access Database Samples: www.rogersaccesslibrary.com
> Want answers to your Access questions in your Email?
> Free subscription:
> http://peach.ease.lsoft.com/scripts/...UBED1=ACCESS-L
>
> "jknoll" <(E-Mail Removed)> wrote in message
> news:4491BE30-D520-4DFA-9BB0-(E-Mail Removed)...
> >I don't have the TransferText action in the drop down when I am building a
> > macro... Am I in the wrong place?
> >
> > I've changed the acExportFixed to acExportDelim and changed the saved
> > export
> > specificaiton to a delimited export. I still get the same error.
> >
> > Any ideas?
> >
> > "Roger Carlson" wrote:
> >
> >> Well, no. You're using a fixed export in the TransferText and CSV is a
> >> delimited format. Here's what I would do:
> >>
> >> 1: Export the table as a CSV manually, creating and saving an Export
> >> Specification in the process. (That is, only if you need it. The
> >> vanilla
> >> Delimited export may work just fine.)
> >> 2. Create a macro using the TransferText action and fill in all the
> >> arguments in the lower portion. Make sure you select Export Delimited in
> >> the Transfer Type line.
> >> 3. Save the macro As a VB module. This will give you the correct syntax
> >> for
> >> your DoCmd.TransferText line.
> >>
> >> --
> >> --Roger Carlson
> >> MS Access MVP
> >> Access Database Samples: www.rogersaccesslibrary.com
> >> Want answers to your Access questions in your Email?
> >> Free subscription:
> >> http://peach.ease.lsoft.com/scripts/...UBED1=ACCESS-L
> >>
> >>
> >> "jknoll" <(E-Mail Removed)> wrote in message
> >> news:2B227701-F20E-4A16-AAC0-(E-Mail Removed)...
> >> >I have a table: Inspection_EXPORT with an export specification:
> >> >RTM_export.
> >> > I want to export the table into a CSV file locally. I've written a
> >> > function
> >> > in a module using Transfer.text to do this:
> >> >
> >> > Public Function EXPORT_Inspections()
> >> >
> >> > DoCmd.TransferText acExportFixed, "RTM_Export", "Inspection_EXPORT",
> >> > "c:\test.txt", True
> >> >
> >> > End Function
> >> >
> >> > I am getting this error:
> >> > Run-time error '3011':
> >> > "The Microsoft Office Access database engine could not find the object
> >> > 'test#txt'. Make sure the object exists and that you spell its name and
> >> > the
> >> > path name correctly.
> >> >
> >> > ---------
> >> > I have a few questions.
> >> > 1- Why is the engine trying to make sure the future export file exists?
> >> > It's an exported file, it doesnt exist yet...
> >> > 2- Why is it being referred to as 'test#txt'? Did I write the wrong
> >> > syntax?
> >> > 3- If I wanted a .CSV file, could I just name it test.csv- or do I need
> >> > to
> >> > do something else?
> >> >
> >> > Thanks for your patience and help.
> >>
> >>
> >>
>
>
>