Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

OLE from VB5 to Access97

Posted on 1998-12-16
7
Medium Priority
?
261 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 1

Accepted Solution

by:
jeffcameron earned 200 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
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

597 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