If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > keep access invisible when using New Access.Application OpenCurrentDatabase

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-28-11, 13:31
Rx_ Rx_ is offline
Registered User
 
Join Date: Jul 2011
Posts: 2
Post 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
Reply With Quote
  #2 (permalink)  
Old 07-29-11, 12:41
apr pillai apr pillai is offline
Registered User
 
Join Date: Jan 2009
Location: Kerala, India
Posts: 107
Try after moving line 35 between 20 and 30.
__________________
http://www.msaccesstips.com (Learn MS-Access Tips & Tricks)
Learn Advanced MS-Access Programming with sample VBA Code.
Reply With Quote
  #3 (permalink)  
Old 07-29-11, 17:03
HiTechCoach HiTechCoach is offline
Registered User
 
Join Date: May 2010
Posts: 600
Quote:
Originally Posted by apr pillai View Post
Try after moving line 35 between 20 and 30.
The OP already said they tried that:

Quote:
(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
Reply With Quote
  #4 (permalink)  
Old 07-29-11, 17:28
HiTechCoach HiTechCoach is offline
Registered User
 
Join Date: May 2010
Posts: 600
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
Reply With Quote
Reply

Tags
false, opencurrentdatabase, visible

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On