Is External Database Open

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • neptune

    Is External Database Open

    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.Applicat ion
    appAccess.OpenC urrentDatabase ("G:\RebateRepo rt.mdb")
    appAccess.Run "ProcessAll "
    appAccess.Close CurrentDatabase
    End Sub

    The problem is "RebateReport.m db" 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:\RebateRepor t.mdb"
    If appAccess.IsOpe n Then
    appAccess.FileC lose
    EndIf

    Of course this is improper syntax. How would I do this?
  • Douglas J. Steele

    #2
    Re: Is External Database Open

    Check whether G:\RebateReport .ldb exists.

    --
    Doug Steele, Microsoft Access MVP

    (No private e-mails, please)



    "neptune" <bsimmons1482@h otmail.com> wrote in message
    news:c5b7a250.0 403041415.4afa8 326@posting.goo gle.com...[color=blue]
    > 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.Applicat ion
    > appAccess.OpenC urrentDatabase ("G:\RebateRepo rt.mdb")
    > appAccess.Run "ProcessAll "
    > appAccess.Close CurrentDatabase
    > End Sub
    >
    > The problem is "RebateReport.m db" 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:\RebateRepor t.mdb"
    > If appAccess.IsOpe n Then
    > appAccess.FileC lose
    > EndIf
    >
    > Of course this is improper syntax. How would I do this?[/color]


    Comment

    • Tom van Stiphout

      #3
      Re: Is External Database Open

      On Thu, 04 Mar 2004 22:54:09 GMT, "Douglas J. Steele"
      <NOSPAM_djsteel e@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.

      [color=blue]
      >Check whether G:\RebateReport .ldb exists.[/color]

      Comment

      • Trevor Best

        #4
        Re: Is External Database Open

        Douglas J. Steele wrote:
        [color=blue]
        > Check whether G:\RebateReport .ldb exists.
        >[/color]
        Try to delete it, it may be left over from a crashed workstation.

        --
        But why is the Rum gone?

        Comment

        • neptune

          #5
          Re: Is External Database Open

          Trevor Best <nospam@localho st> wrote in message news:<40483600$ 0$2659$afc38c87 @auth.uk.news.e asynet.net>...[color=blue]
          > Douglas J. Steele wrote:
          >[color=green]
          > > Check whether G:\RebateReport .ldb exists.
          > >[/color]
          > Try to delete it, it may be left over from a crashed workstation.[/color]

          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:\RebateR eport.ldb") <> "" Then
          Kill "G:\RebateRepor t.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.

          Comment

          • Trevor Best

            #6
            Re: Is External Database Open

            neptune wrote:
            [color=blue]
            > Trevor Best <nospam@localho st> wrote in message news:<40483600$ 0$2659$afc38c87 @auth.uk.news.e asynet.net>...
            >[color=green]
            >>Douglas J. Steele wrote:
            >>
            >>[color=darkred]
            >>>Check whether G:\RebateReport .ldb exists.
            >>>[/color]
            >>
            >>Try to delete it, it may be left over from a crashed workstation.[/color]
            >
            >
            > 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:\RebateR eport.ldb") <> "" Then
            > Kill "G:\RebateRepor t.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.[/color]

            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?

            Comment

            Working...