PC Review


Reply
Thread Tools Rate Thread

Code causing Access to unexpectedly Quit

 
 
Mike Hinde
Guest
Posts: n/a
 
      18th Sep 2003
Wondering if anyone can offer suggestions for overcoming a
problem the code below is currently giving me?

It's a simple little code to switch between 2 databases
that appears to work fine (and indeed DOES work fine
switching between 3 out of 5 databases) but when you start
using forms in the newly opened database, clicking on
forms/running certain bits of code causes Access to close
down for no apparant reason.

All databases work fine when opened individually - only
when opened using this code do the problems occur.

Any ideas as to what is going wrong/what I've done wrong
would be most appreciated??


*****************************************************
Private Sub Box8_Click()
Const strConPathToEMS = "C:\database.mdb"
Dim appAccess As Access.Application

'Open another Access and the required database
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase strConPathToEMS
appAccess.Visible = True
appAccess.RunCommand acCmdAppMaximize
appAccess.DoCmd.OpenForm "frmSwitchboard"
appAccess.Forms("frmSwitchboard").SetFocus
'Close calling database
DoCmd.Close acForm, Me.Name, acSaveNo
DoCmd.Quit
End Sub
***************************************************
 
Reply With Quote
 
 
 
 
HSalim
Guest
Posts: n/a
 
      18th Sep 2003
look here for TSI's SOON - Shut One Open New

http://www.trigeminal.com/lang/1033/...asp?ItemID=8#8

HS

"Mike Hinde" <(E-Mail Removed)> wrote in message
news:03c001c37dc1$48a8fba0$(E-Mail Removed)...
> Wondering if anyone can offer suggestions for overcoming a
> problem the code below is currently giving me?
>
> It's a simple little code to switch between 2 databases
> that appears to work fine (and indeed DOES work fine
> switching between 3 out of 5 databases) but when you start
> using forms in the newly opened database, clicking on
> forms/running certain bits of code causes Access to close
> down for no apparant reason.
>
> All databases work fine when opened individually - only
> when opened using this code do the problems occur.
>
> Any ideas as to what is going wrong/what I've done wrong
> would be most appreciated??
>
>
> *****************************************************
> Private Sub Box8_Click()
> Const strConPathToEMS = "C:\database.mdb"
> Dim appAccess As Access.Application
>
> 'Open another Access and the required database
> Set appAccess = CreateObject("Access.Application")
> appAccess.OpenCurrentDatabase strConPathToEMS
> appAccess.Visible = True
> appAccess.RunCommand acCmdAppMaximize
> appAccess.DoCmd.OpenForm "frmSwitchboard"
> appAccess.Forms("frmSwitchboard").SetFocus
> 'Close calling database
> DoCmd.Close acForm, Me.Name, acSaveNo
> DoCmd.Quit
> End Sub
> ***************************************************



 
Reply With Quote
 
TC
Guest
Posts: n/a
 
      20th Sep 2003
Are you saying that the exact code shown in your post, works with certain
values in strConPathToEMS, and does not work with other values?

When you say that clicking on forms/running certain bits of code causes
Access to close down for no apparant reason, I assume you mean the copy of
Access that is created by the CreateObject call? That copy works ok when you
have used certain values of strConPathToEMS, but cloes down unexpectedly
when you use other values of strConPathToEMS? Does the "calling" copy of
Access close (or not close?) consistently in all cases?

I'm just strying to get a clear picture of what is hapenning, before I
suggest a cause.

TC


Mike Hinde <(E-Mail Removed)> wrote in message
news:03c001c37dc1$48a8fba0$(E-Mail Removed)...
> Wondering if anyone can offer suggestions for overcoming a
> problem the code below is currently giving me?
>
> It's a simple little code to switch between 2 databases
> that appears to work fine (and indeed DOES work fine
> switching between 3 out of 5 databases) but when you start
> using forms in the newly opened database, clicking on
> forms/running certain bits of code causes Access to close
> down for no apparant reason.
>
> All databases work fine when opened individually - only
> when opened using this code do the problems occur.
>
> Any ideas as to what is going wrong/what I've done wrong
> would be most appreciated??
>
>
> *****************************************************
> Private Sub Box8_Click()
> Const strConPathToEMS = "C:\database.mdb"
> Dim appAccess As Access.Application
>
> 'Open another Access and the required database
> Set appAccess = CreateObject("Access.Application")
> appAccess.OpenCurrentDatabase strConPathToEMS
> appAccess.Visible = True
> appAccess.RunCommand acCmdAppMaximize
> appAccess.DoCmd.OpenForm "frmSwitchboard"
> appAccess.Forms("frmSwitchboard").SetFocus
> 'Close calling database
> DoCmd.Close acForm, Me.Name, acSaveNo
> DoCmd.Quit
> End Sub
> ***************************************************



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: this application has unexpectedly quit Michael Windows XP General 0 6th Apr 2010 07:47 PM
Opening a form cause Access to quit unexpectedly =?Utf-8?B?Q2hyaXN0aWFu?= Microsoft Access VBA Modules 2 8th Aug 2007 08:43 AM
quit unexpectedly cont--- KNC Microsoft Dot NET Compact Framework 0 6th Jul 2005 07:29 AM
quit unexpectedly KNC Microsoft Dot NET Compact Framework 10 21st Apr 2005 12:10 PM
Re: Outlook Quit Unexpectedly StuartUSA Microsoft Outlook 0 17th Nov 2003 12:27 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:15 PM.