Solved

OLE from VB5 to Access97

Posted on 1998-12-16
7
255 Views
Last Modified: 2013-11-25
Here is my code:

    Dim objAccess As Access.Application
    Set objAccess = New Access.Application
    objAccess.OpenCurrentDatabase DBName
    objAccess.Application.Visible = True

It starts Access from VB.  Access flashes for a second or two and then disappears.  How do I keep Access97 Open and viewable until I desire otherwise?

Thanks in Advance,
DoughBoy
0
Comment
Question by:DoughBoy
  • 4
  • 3
7 Comments
 
LVL 1

Accepted Solution

by:
jeffcameron earned 50 total points
ID: 1450800
you don't have to create the access variable it is already global and is called Access.  The code you need is below

Access.OpenCurrentDatabase  DBFileName
Access.Visible = True

AppActivate "Microsoft Access"
0
 

Author Comment

by:DoughBoy
ID: 1450801
Thanks Jeff,  your suggestion worked.  You can receive full credit.  
Can I ask you a follow up question?  I should have made the requirement that Microsoft Access Library 8.0 can not be referenced by VB IDE.  Now how do I open Access to a specific DB and keep it open until I feel like closing it?

Thanks for your help,
DoughBoy
0
 
LVL 1

Expert Comment

by:jeffcameron
ID: 1450802
' you must declare your variable globally so
' it stays in memory once access becomes dereferenced
' it closes
Private Access as object


Private Sub OpenDatabase( Filename as string )
Set Access = CreateObject("Access.Application")

Access.OpenCurrentDatabase Filename
Access.Visible = True

End Sub
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 

Author Comment

by:DoughBoy
ID: 1450803
Thanks so much.  It worked.  What references have/do you use to learn VB?  Your help has been much appreciated.
0
 
LVL 1

Expert Comment

by:jeffcameron
ID: 1450804
I have learned it all from either the help files or the Internet, I have never bought a book or a magazine and have never taken a class.  I have been actively using VB for 5+ years and have put a lot of time into learning COM technologies(it is how you are opening Access).  I have found that the more you learn the faster you learn, because you figure out how to get the information you wan't more quickly (an exponential learning curve).  So just stick with it, it will get easier and easier.  
I don't know your application but if you are very interested in using VB with Access as a database, you should investigate DAO if you are using VB 5.0 or ADO if using VB 6.0.  However it sounds like you want to take advantage of the Access itself and not just Access as a database.  Just a bit of advice.  Jeff      
0
 

Author Comment

by:DoughBoy
ID: 1450805
Thanks.  I appreciate the reply.
0
 

Author Comment

by:DoughBoy
ID: 1450806
Thanks.  I appreciate the reply.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question