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

Is External Database Open

P: n/a
Hello,
My current application opens and runs a procedure in a separate Access
database. It looks like this.

Public Sub ProcessAll()
Dim appAccess As New Access.Application
appAccess.OpenCurrentDatabase ("G:\RebateReport.mdb")
appAccess.Run "ProcessAll"
appAccess.CloseCurrentDatabase
End Sub

The problem is "RebateReport.mdb" must be closed or it will not
process. I need code that would close it if it were open and then
re-open and run it.

I need to add something like:

appAccess.Path="G:\RebateReport.mdb"
If appAccess.IsOpen Then
appAccess.FileClose
EndIf

Of course this is improper syntax. How would I do this?
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Check whether G:\RebateReport.ldb exists.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

"neptune" <bs**********@hotmail.com> wrote in message
news:c5**************************@posting.google.c om...
Hello,
My current application opens and runs a procedure in a separate Access
database. It looks like this.

Public Sub ProcessAll()
Dim appAccess As New Access.Application
appAccess.OpenCurrentDatabase ("G:\RebateReport.mdb")
appAccess.Run "ProcessAll"
appAccess.CloseCurrentDatabase
End Sub

The problem is "RebateReport.mdb" must be closed or it will not
process. I need code that would close it if it were open and then
re-open and run it.

I need to add something like:

appAccess.Path="G:\RebateReport.mdb"
If appAccess.IsOpen Then
appAccess.FileClose
EndIf

Of course this is improper syntax. How would I do this?

Nov 12 '05 #2

P: n/a
On Thu, 04 Mar 2004 22:54:09 GMT, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:

Cool !
I would NEVER have thought of that. I was about to use at least half a
dozen API calls to answer the question.

-Tom.

Check whether G:\RebateReport.ldb exists.


Nov 12 '05 #3

P: n/a
Douglas J. Steele wrote:
Check whether G:\RebateReport.ldb exists.

Try to delete it, it may be left over from a crashed workstation.

--
But why is the Rum gone?
Nov 12 '05 #4

P: n/a
Trevor Best <nospam@localhost> wrote in message news:<40**********************@auth.uk.news.easyne t.net>...
Douglas J. Steele wrote:
Check whether G:\RebateReport.ldb exists.

Try to delete it, it may be left over from a crashed workstation.


Thanks for the tip. I realized a new instance isn't opening because a
..ldb file exists from a previous crash. I checked to see if it exists
and try to delete it.

If Dir("G:\RebateReport.ldb") <> "" Then
Kill "G:\RebateReport.ldb"
End If

The Kill command results in an error, "permission denied" I've used
the kill to delete word files, but I don't understand why it doesn't
delete the lock file.
Nov 12 '05 #5

P: n/a
neptune wrote:
Trevor Best <nospam@localhost> wrote in message news:<40**********************@auth.uk.news.easyne t.net>...
Douglas J. Steele wrote:

Check whether G:\RebateReport.ldb exists.


Try to delete it, it may be left over from a crashed workstation.

Thanks for the tip. I realized a new instance isn't opening because a
.ldb file exists from a previous crash. I checked to see if it exists
and try to delete it.

If Dir("G:\RebateReport.ldb") <> "" Then
Kill "G:\RebateReport.ldb"
End If

The Kill command results in an error, "permission denied" I've used
the kill to delete word files, but I don't understand why it doesn't
delete the lock file.


If it can't delete the lock file (with Permission Denied) then it's
because the file is open on another workstation or the crashed
workstation hasn't had it's connection cleared yet.
--
But why is the Rum gone?
Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.