Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2011
    Posts
    2

    Post Unanswered: keep access invisible when using New Access.Application OpenCurrentDatabase

    Passing in the database name and table name opens the database and makes it visible for a split second until line 35 is executed.
    Any ideas on how to prevent this? Or how to accomplish the same result with out the quick flash?

    (placeing line 35 at line 25 won't work either)

    Code:
    Function OldestDate(RemoteDatabase As String, RemoteTable As String)
    10    On Error Resume Next
          Dim objAccess As Access.Application
    20    Set objAccess = New Access.Application
    30        objAccess.OpenCurrentDatabase RemoteDatabase
    35          objAccess.Visible = False
    40        OldestDate = objAccess.DMin("[Publish_Date]", RemoteTable)
    50        If Err.Number = 2110 Then
    60            OldestDate = 0  ' If table is deleted report 0 records
    70            Err.Clear
    80        End If
    90        objAccess.CloseCurrentDatabase
    100       Set objAccess = Nothing
    End Function

  2. #2
    Join Date
    Jan 2009
    Location
    Kerala, India
    Posts
    183
    Try after moving line 35 between 20 and 30.
    www.MsAccessTips.com (Learn MS-Access Tips & Tricks)
    Learn Advanced MS-Access Programming with sample VBA Code.

    All responses are based on Access 2003/2007

  3. #3
    Join Date
    May 2010
    Posts
    601
    Quote Originally Posted by apr pillai View Post
    Try after moving line 35 between 20 and 30.
    The OP already said they tried that:

    (placeing line 35 at line 25 won't work either)
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  4. #4
    Join Date
    May 2010
    Posts
    601
    RX,

    If I were doing this I would not launch another Access session just to get a value from a table.

    I would open a recordset that uses the table in the other database. This avoids all the overhead of stating another instance of Access.
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •