Export from Table

G

Guest

When I Export data from a table to a text file manually it works fine but
when I execute it from code with a saved Export specification I get the
message below

The Microsoft Jet database engine cannot open the file 'SumOfcurStateEeSIT'.
It is already open exclusively by another user, or you need permission to
view its data I have copied the code below

Function ExportNewQtrTax()
On Error GoTo ExportNewQtrTax_Err

Dim FN As String
FN = Format((Now), "yyyymmdd") & "-tblNewQtrTaxExp.txt"

DoCmd.TransferText acExportFixed, "NewQtrTaxExp Export
Specification", "tblNewQtrTaxExp", "//CTFLAN/NETWORK/DB" & FN, False, ""
Beep
MsgBox "New Qurterly Tax Export Complete", vbOKOnly, "Domestic Partner"

ExportNewQtrTax_Exit:
Exit Function

ExportNewQtrTax_Err:
MsgBox Error$
Resume ExportNewQtrTax_Exit

End Function


Does anyone know how to deal with this problem, any help would be
appriciated.

David C. Widener
 
G

Guest

Hi, David.
When I Export data from a table to a text file manually it works fine but
when I execute it from code with a saved Export specification I get the
message

It's a possibility that you do not have Windows security permissions to
write a file to the destination directory, but it's more likely the
tblNewQtrTaxExp table does not contain the field "SumOfcurStateEeSIT" named
in the specification. Ensure that you have permissions to write the file to
that particular directory (not just a test on your own hard drive) and check
the specification and compare it to the fields in the table. The fields
named in the specification must match the name and data type of the field in
the table.

Microsoft operating systems use the backslash to differentiate between
subdirectories, not the slash as you have used in your syntax. You should
use the backslash in the syntax.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
6

'69 Camaro

Hi, David.

Well, I did mention the possibility that you do not have Windows security
permissions to
write a file to the destination directory! You don't have any permissions
on a directory that doesn't exist. Glad you figured it.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
 

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