By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,369 Members | 950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,369 IT Pros & Developers. It's quick & easy.

OpenCurrentDatabase fails in Access 2000

P: n/a
Part of a Windows Service app I created in .NET 2003 has
the following code:

Dim stOutPath As String
Dim stTableName As String
Const strDBPath As String = "C:\test_be.mdb"

acApp = New Access.Application
With acApp
stTableName = "tblTest"
stOutPath = "C:\IN\test.txt"
.OpenCurrentDatabase(strDBPath)
.DoCmd.TransferText(stTableName, stOutPath)
.CloseCurrentDatabase()
End With

acApp.Quit()
acApp = Nothing

This code creates an Access application object, does an
import from a text file (stOutPath) and generates an
Access table (stTableName). This service functions on my
development machine which is running Access 2002. However
it fails to run on my production machine which is running
Access 2000. Does anyone know why this would be? I'm
certain file to be imported exists and that the Access
Application object is being created but then
the .OpenCurrentDatabase(strDBPath) fails. I just want to
rule out anything on the .NET side

Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Wed, 3 Sep 2003 07:41:20 -0700, "Zachariah" <za*********@yahoo.com> wrote:

Part of a Windows Service app I created in .NET 2003 has
the following code:

Dim stOutPath As String
Dim stTableName As String
Const strDBPath As String = "C:\test_be.mdb"

acApp = New Access.Application
With acApp
stTableName = "tblTest"
stOutPath = "C:\IN\test.txt"
.OpenCurrentDatabase(strDBPath)
.DoCmd.TransferText(stTableName, stOutPath)
.CloseCurrentDatabase()
End With

acApp.Quit()
acApp = Nothing

This code creates an Access application object, does an
import from a text file (stOutPath) and generates an
Access table (stTableName). This service functions on my
development machine which is running Access 2002. However
it fails to run on my production machine which is running
Access 2000. Does anyone know why this would be? I'm
certain file to be imported exists and that the Access
Application object is being created but then
the .OpenCurrentDatabase(strDBPath) fails. I just want to
rule out anything on the .NET side

I don't know what kind of error you are getting but if I had to guess I would say it's probably a
permissions related issue.

The account under which the service is executing must have read/write/create/delete access to the
specified file or folder where the file resides.
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Jul 19 '05 #2

P: n/a
On Thu, 4 Sep 2003 09:50:18 -0700, "Zachariah" <za*********@yahoo.com> wrote:

I don't know which error it is either. All I can do is
throw in code to make log entries and that's how I know
it's failing on the OpenCurrentDatabase line. The service
is running with Administrator rights so it shouldn't be an
authentication issue.

Couple of things you can do to troubleshoot this problem:

1) Check the System Event log to see if there are related errors.

2) Track the errors on your production machine using the Filemon utility
(http://www.sysinternals.com/ntw2k/source/filemon.shtml)
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.