Export Dialog Box

A

Andy

I've been able to (with some help!) get a button to function on a form to
prompt for a Dialog box for a file to import with set specification to a
table name.

I now want to do the opposite. Some script for a button to export a table
under a specification via a Save As Dialog Box.

http://www.mvps.org/access/api/api0001.htm was great for an import, but I'm
struggling with an import.

My import text ended up as:

Private Sub Command51_Click()
Dim strFilter As String
Dim strInputFileName As String

strFilter = ahtAddFilterItem(strFilter, _
"CSV Files (*.csv)", "*.csv")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select the .csv file to Import...", _
Flags:=ahtOFN_HIDEREADONLY)
If Len(strInputFileName) > 0 Then
DoCmd.TransferText acImportDelim, "Trust Episode Upload", "Trust
Upload ", strInputFileName, False, ""
X = MsgBox("The File Upload Process is now complete. You may proceed
and process the Trust Data ready for audit", 64, "Clinical Coding Audit
Package")
End If

End Sub
 
K

Klatuu

The code you refer to has nothing to do with whether you want to do an import
or an export. All it does is return either a path and file name or a zero
length string if the user cancels. Once the value is returned from the
dialog, it is up to you to do what ever you want with it.

The only difference between the import and the export is the first argument.
Where you have acImportDelim, you would use acExportDelim instead. If it is
not the same table or query being used, you may need a differnt Spec file as
well.
 

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

Top