LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Access form from Excel

Hello,

I am using the OpenCurrentDatabase method with the following code:

Sub Pref(seeit As Boolean, openit As Boolean)

Dim PrefPath As String

'Path of pref.mdb
PrefPath = ThisWorkbook.Path & "\pref.mdb"

'Open Access and make it visible when seeit=true
Set oApp = CreateObject("Access.Application")
oApp.Visible = seeit

'open pref.mdb
oApp.OpenCurrentDatabase PrefPath

'open the following query
oApp.DoCmd.OpenQuery "qAppendFax"
oApp.DoCmd.OpenQuery "qDeleteFax"
oApp.DoCmd.OpenQuery "qAppendTeor"
oApp.DoCmd.OpenQuery "qdeleteTeor"
'open the fax form if openit=true
If openit Then
oApp.DoCmd.OpenForm "fax"
End If
'closes db
oApp.CloseCurrentDatabase
Set oApp = Nothing
End Sub

the boolean argument seeit allows to show or to hide the Access window
while openit allows to skip the opening of the "fax" form.
My issue is that when the two arguments are both set on true Access
don't stays open on the form but closes immediately. This event don't
happen if the two statements

oApp.CloseCurrentDatabase
Set oApp = Nothing

are omitted.

Are these two statements necessary, or I get the same result closing
the Access window manually?

Moreover is it possible to get the Access window open maximized?

Emiliano


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using ADO from Excel form to relational Access Db bluegrassstateworker Excel Programming 4 February 21st 08 06:13 AM
Access Form to Excel sheet KevinKBM Excel Discussion (Misc queries) 1 August 3rd 07 09:02 AM
moving an Access form to Excel TomHinkle Excel Programming 0 November 18th 05 04:15 PM
Add a value from Excel to a form in access Kevbrad1 Excel Programming 1 May 16th 05 08:36 PM
get access form in excel Laurent M Excel Discussion (Misc queries) 1 January 27th 05 12:30 PM


All times are GMT +1. The time now is 08:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"