Discussion:
Access aus VBA minimiert starten
(zu alt für eine Antwort)
Wolfgang Ehrengruber
2003-12-09 15:33:00 UTC
Permalink
Hallo - ich richte in MS Visio eine Datenbankverbindung ein:

Dim appAccess As Object
Dim dbs As Object, tdf As Object, fld As Variant
Dim strDB As String
Const DB_Text As Long = 10
Const FldLen As Integer = 40

' Initialize string to database path.
strDB = dateiname
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")

' Open database in Microsoft Access window.
appAccess.NewCurrentDatabase strDB
' Get Database object variable.
Set dbs = appAccess.CurrentDb

An dieser Stelle öffnet sich MS Access und verdeckt den Export-Vorgang. Ist
es möglich Access minimiert zu "starten"? Wenn ja, wie?

dbs.DoCmd.Runcomand acCmdAppMinimize funktioniert leider nicht ==> Objekt
unterstützt Eigenschaft oder Methode nicht
Karl Donaubauer
2003-12-09 15:38:37 UTC
Permalink
Post by Wolfgang Ehrengruber
Dim appAccess As Object
Dim dbs As Object, tdf As Object, fld As Variant
Dim strDB As String
Const DB_Text As Long = 10
Const FldLen As Integer = 40
' Initialize string to database path.
strDB = dateiname
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")
' Open database in Microsoft Access window.
appAccess.NewCurrentDatabase strDB
' Get Database object variable.
Set dbs = appAccess.CurrentDb
An dieser Stelle öffnet sich MS Access und verdeckt den Export-Vorgang.
Ist es möglich Access minimiert zu "starten"? Wenn ja, wie?
dbs.DoCmd.Runcomand acCmdAppMinimize funktioniert leider nicht ==> Objekt
unterstützt Eigenschaft oder Methode nicht
Im Thread bleiben, wäre gescheiter.

Es fehlt ein m bei: RunCommand
--
HTH
Karl
********* Ich beantworte keine Access-Fragen per Email. *********
Access-FAQ: http://www.donkarl.com
Datenbankprofis: http://www.dbdev.org
Wolfgang Ehrengruber
2003-12-09 15:50:22 UTC
Permalink
Post by Karl Donaubauer
bzgl. gleicher Thread
Sorry.. bleib ab jetzt im gleichen Thread

dbs.DoCmd.RunCommand acCmdAppMinimize
wirft trotzdem den fehler Objekt unterstützt Eigenschaft oder Methode nicht.

'ACCESS Code
Dim appAccess As Object
Dim dbs As Object, tdf As Object, fld As Variant
Dim strDB As String
Const DB_Text As Long = 10
Const FldLen As Integer = 40

' Initialize string to database path.
'strDB = "C:\VisioExport.mdb"
strDB = dateiname
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")

' Open database in Microsoft Access window.
appAccess.NewCurrentDatabase strDB
' Get Database object variable.
Set dbs = appAccess.CurrentDb
dbs.DoCmd.RunCommand acCmdAppMinimize
Post by Karl Donaubauer
Dim appAccess As Object
Dim dbs As Object, tdf As Object, fld As Variant
Dim strDB As String
Const DB_Text As Long = 10
Const FldLen As Integer = 40
' Initialize string to database path.
strDB = dateiname
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")
' Open database in Microsoft Access window.
appAccess.NewCurrentDatabase strDB
' Get Database object variable.
Set dbs = appAccess.CurrentDb
An dieser Stelle öffnet sich MS Access und verdeckt den Export-Vorgang.
Ist es möglich Access minimiert zu "starten"? Wenn ja, wie?
dbs.DoCmd.Runcomand acCmdAppMinimize funktioniert leider nicht ==> Objekt
unterstützt Eigenschaft oder Methode nicht
Im Thread bleiben, wäre gescheiter.
Es fehlt ein m bei: RunCommand
--
HTH
Karl
********* Ich beantworte keine Access-Fragen per Email. *********
Access-FAQ: http://www.donkarl.com
Datenbankprofis: http://www.dbdev.org
Gunter Avenius
2003-12-09 15:56:09 UTC
Permalink
Hallo Wolfgang,
Post by Wolfgang Ehrengruber
Dim appAccess As Object
Dim dbs As Object, tdf As Object, fld As Variant
Dim strDB As String
Const DB_Text As Long = 10
Const FldLen As Integer = 40
' Initialize string to database path.
strDB = dateiname
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")
' Open database in Microsoft Access window.
appAccess.NewCurrentDatabase strDB
' Get Database object variable.
Set dbs = appAccess.CurrentDb
An dieser Stelle öffnet sich MS Access und verdeckt den
Export-Vorgang. Ist es möglich Access minimiert zu "starten"? Wenn
ja, wie?
dbs.DoCmd.Runcomand acCmdAppMinimize funktioniert leider nicht ==>
Objekt unterstützt Eigenschaft oder Methode nicht
War ein Fehler meinerseits, sorry.

Public Function Test(strdb As String)
' Aufruf: Test("c:\Deinedb.mdb")
' Aus Access FAQ umgebaut

Dim appAcc As Access.Application
Set appAcc = New Access.Application

appAcc.OpenCurrentDatabase strdb
appAcc.Visible = True
appAcc.DoCmd.RunCommand acCmdAppMaximize

' Dein Schlauer Code
'
'
appAcc.Quit
Set appAcc = Nothing

End Function
--
Gruß
Gunter
_________________________________________________
Access FAQ: http://www.donkarl.com
home: http://www.avenius.com
Wolfgang Ehrengruber
2003-12-10 07:49:00 UTC
Permalink
Hallo und danke schön!

Das Problem ist aber, dass ich eine neue Datenbank anlege (siehe meinen
code).

Die Methode RunCommand führt zu der Fehlermeldung "RunCommand wurde
abgebrochen"
Post by Gunter Avenius
Hallo Wolfgang,
Post by Wolfgang Ehrengruber
Dim appAccess As Object
Dim dbs As Object, tdf As Object, fld As Variant
Dim strDB As String
Const DB_Text As Long = 10
Const FldLen As Integer = 40
' Initialize string to database path.
strDB = dateiname
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")
' Open database in Microsoft Access window.
appAccess.NewCurrentDatabase strDB
' Get Database object variable.
Set dbs = appAccess.CurrentDb
An dieser Stelle öffnet sich MS Access und verdeckt den
Export-Vorgang. Ist es möglich Access minimiert zu "starten"? Wenn
ja, wie?
dbs.DoCmd.Runcomand acCmdAppMinimize funktioniert leider nicht ==>
Objekt unterstützt Eigenschaft oder Methode nicht
War ein Fehler meinerseits, sorry.
Public Function Test(strdb As String)
' Aufruf: Test("c:\Deinedb.mdb")
' Aus Access FAQ umgebaut
Dim appAcc As Access.Application
Set appAcc = New Access.Application
appAcc.OpenCurrentDatabase strdb
appAcc.Visible = True
appAcc.DoCmd.RunCommand acCmdAppMaximize
' Dein Schlauer Code
'
'
appAcc.Quit
Set appAcc = Nothing
End Function
--
Gruß
Gunter
_________________________________________________
Access FAQ: http://www.donkarl.com
home: http://www.avenius.com
Gunter Avenius
2003-12-10 08:01:48 UTC
Permalink
Hallo Wolfgang,
Post by Wolfgang Ehrengruber
Das Problem ist aber, dass ich eine neue Datenbank anlege (siehe
meinen code).
Die Methode RunCommand führt zu der Fehlermeldung "RunCommand wurde
abgebrochen"
kurz getestet und funktioniert:

Public Function DeineFunction(dateiname As String)
Dim appAccess As Object
Dim dbs As Object, tdf As Object, fld As Variant
Dim strDB As String
Const DB_Text As Long = 10
Const FldLen As Integer = 40

' Initialize string to database path.
strDB = dateiname
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")

' Open database in Microsoft Access window.
appAccess.NewCurrentDatabase strDB
' Get Database object variable.
Set dbs = appAccess.CurrentDb

appAccess.DoCmd.RunCommand acCmdAppRestore
appAccess.DoCmd.RunCommand acCmdAppMinimize

' Aufräumen nicht vergessen!!!
End Function

--
Gruß
Gunter
_________________________________________________
Access - FAQ: http://www.donkarl.com
home: http://www.avenius.com
Wolfgang Ehrengruber
2003-12-10 08:17:23 UTC
Permalink
Hallo Gunter!

Vielen Dank für die Mühe - allerdings tritt der Fehler immernoch auf

mein Code:

Dim appAccess As Object
Dim dbs As Object, tdf As Object, fld As Variant
Dim strDB As String

' Initialize string to database path.
strDB = dateiname
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")

' Open database in Microsoft Access window.
appAccess.NewCurrentDatabase strDB
' Get Database object variable.
Set dbs = appAccess.CurrentDb

'Diese Zeile führt zu dem Laufzeitfehler "RunCommand wurde abgebrochen"
appAccess.DoCmd.RunCommand acCmdAppRestore
appAccess.DoCmd.RunCommand cCmdAppMinimize
Post by Gunter Avenius
Hallo Wolfgang,
Post by Wolfgang Ehrengruber
Das Problem ist aber, dass ich eine neue Datenbank anlege (siehe
meinen code).
Die Methode RunCommand führt zu der Fehlermeldung "RunCommand wurde
abgebrochen"
Public Function DeineFunction(dateiname As String)
Dim appAccess As Object
Dim dbs As Object, tdf As Object, fld As Variant
Dim strDB As String
Const DB_Text As Long = 10
Const FldLen As Integer = 40
' Initialize string to database path.
strDB = dateiname
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")
' Open database in Microsoft Access window.
appAccess.NewCurrentDatabase strDB
' Get Database object variable.
Set dbs = appAccess.CurrentDb
appAccess.DoCmd.RunCommand acCmdAppRestore
appAccess.DoCmd.RunCommand acCmdAppMinimize
' Aufräumen nicht vergessen!!!
End Function
--
Gruß
Gunter
_________________________________________________
Access - FAQ: http://www.donkarl.com
home: http://www.avenius.com
Gunter Avenius
2003-12-10 08:26:13 UTC
Permalink
Hallo Wolfgang,
Post by Wolfgang Ehrengruber
Vielen Dank für die Mühe - allerdings tritt der Fehler immernoch auf
appAccess.DoCmd.RunCommand cCmdAppMinimize
da fehlt ein a
acCmdAppMinimize

habe es nochmals getestet und bei mir läuft der Code.
Kopiere mal den Code von mir 1 zu 1 in ein Neues Modul und rufe dan im
Direktfenster:

DeineFunction("c:\NeueDB.mdb")

--
Gruß
Gunter
_________________________________________________
Access - FAQ: http://www.donkarl.com
home: http://www.avenius.com

Loading...