473,386 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Fire-up MS Access Database from VB and Leave it Running When VB App is Closed?

Hiya,

Anybody know how to do this please? I am opening Access from VB using
the code below. However, I don't want Access to close when objAccess
goes out of scope. I would like Access to remain open - like MS Excel
does if you write similar code.

I am trying to avoid using the Shell function because I don't want to
have to search for MSAccess.exe first.

If you step through the code and click on the Access session before
continuing through the VB code, it seems to know that you have
interacted with it and leaves Access open. I have tried throwing in an
AppActivate "MsAccess" to simulate this but it still closes Access as
soon as the VB code stops running.

I'm testing with VB6 and Access 97.

Thanks.

If chkOpen Then
On Error Resume Next
Set objAccess = CreateObject("Access.Application")
objAccess.OpenCurrentDatabase (strFilename)
End If
Nov 12 '05 #1
3 1482
On 26 Apr 2004 05:01:55 -0700, da**********@uk.royalsun.com (Dave)
wrote:

When the object reference goes out of scope, the object - Access in
this case - is closed. Indeed you would have to use Shell. Look for it
in the default place, and if not found, ask the user to find it for
you, using a File/Open dialog.

-Tom.

Hiya,

Anybody know how to do this please? I am opening Access from VB using
the code below. However, I don't want Access to close when objAccess
goes out of scope. I would like Access to remain open - like MS Excel
does if you write similar code.

I am trying to avoid using the Shell function because I don't want to
have to search for MSAccess.exe first.

If you step through the code and click on the Access session before
continuing through the VB code, it seems to know that you have
interacted with it and leaves Access open. I have tried throwing in an
AppActivate "MsAccess" to simulate this but it still closes Access as
soon as the VB code stops running.

I'm testing with VB6 and Access 97.

Thanks.

If chkOpen Then
On Error Resume Next
Set objAccess = CreateObject("Access.Application")
objAccess.OpenCurrentDatabase (strFilename)
End If


Nov 12 '05 #2
Actually, this is not true.

All you have to do is set the Application.UserControl property to True (you
may want to set Application.Visible to true as well!).
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Tom van Stiphout" <to*****@no.spam.cox.net> wrote in message
news:gr********************************@4ax.com...
On 26 Apr 2004 05:01:55 -0700, da**********@uk.royalsun.com (Dave)
wrote:

When the object reference goes out of scope, the object - Access in
this case - is closed. Indeed you would have to use Shell. Look for it
in the default place, and if not found, ask the user to find it for
you, using a File/Open dialog.

-Tom.

Hiya,

Anybody know how to do this please? I am opening Access from VB using
the code below. However, I don't want Access to close when objAccess
goes out of scope. I would like Access to remain open - like MS Excel
does if you write similar code.

I am trying to avoid using the Shell function because I don't want to
have to search for MSAccess.exe first.

If you step through the code and click on the Access session before
continuing through the VB code, it seems to know that you have
interacted with it and leaves Access open. I have tried throwing in an
AppActivate "MsAccess" to simulate this but it still closes Access as
soon as the VB code stops running.

I'm testing with VB6 and Access 97.

Thanks.

If chkOpen Then
On Error Resume Next
Set objAccess = CreateObject("Access.Application")
objAccess.OpenCurrentDatabase (strFilename)
End If

Nov 12 '05 #3
Thanks MichKa, that's exactly what I was looking for. I encountered
this some years ago but couldn't remember it (or find it in any books
or on the web).

Having reviewed the Access 97 documentation it is surprising that it
states that this property is read-only. It's clearly not.

Also, rather surprisingly, I don't need to set the Visible property to
True. My CreateObject("Access.Application") opens a visible instance
of Access. I thought that the default setting of the visible property
was false when automating an object. This suits me this time but still
leaves me a little confused.

Dave.


"Michael \(michka\) Kaplan [MS]" <mi*****@online.microsoft.com> wrote in message news:<40********@news.microsoft.com>...
Actually, this is not true.

All you have to do is set the Application.UserControl property to True (you
may want to set Application.Visible to true as well!).
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: skip | last post by:
Twice today I responded to rude messages (once here, once on the SpamBayes list) whose authors didn't deserve the benefit of my time. In both cases, other people rightfully responded with some...
4
by: genc ymeri | last post by:
Hi, I have a C# from and I'm trying to add some code in onKeyDown event. But it doesn't fire at all............ Any idea ? Thanks a lot.
10
by: SStory | last post by:
I have an aspx page that is used to control automated tasks. It needs to be visited every day at 1am. The host provider provides no such service at present. I was looking for ideas. Thanks...
9
by: J.Marsch | last post by:
I must be missing something here: The Init event for controls does not seem to fire. What I did: Drop a textbox on a blank webform, hook the textbox's Init event. Code: this.Textbox1.Value =...
1
by: ]-[aTc]-[ | last post by:
How do I fire a private void myTabStrip_SelectedIndexChange(object sender, System.EventArgs e) to fire again? I have a post back to my if statment and i have this ... if(Request != null) {
2
by: Sam Miller | last post by:
Hi, I have a button event that won't fire. I left it on Friday and it worked fine. I came back in on Monday and it won't fire. I tried putting another button and just putting a...
3
by: Jimmy | last post by:
Hi, I built a webform with a repeater: <asp:repeater id="rep1" runat="server" DataSource='<%# ar %>'> <ItemTemplate> <asp:Button Runat=server Text="<%# Container.DataItem %>" ID="Button1"...
5
by: Verde | last post by:
This is admittedly an apparently odd request... but please indulge me if you don't mind: Suppose I have two <asp:Button.../> on a page (Button1 and Button2). User clicks Button1 and triggers a...
7
by: Noozer | last post by:
I have a timer on a form. It isn't firing at all. I know that the timer is enabled, and that the interval is low (4000, which should be 4 seconds). To ensure the timer wasn't being inadvertantly...
2
by: Joergen Bech | last post by:
Hope someone has a solution or some suggestions for this. This cannot be right?!? Problem: I have multiple non-modal forms open at the same time. One or more of these forms have a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.