UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
> Vbs To Open Access Maxmized, 2013    
 
   
ry94080
post Dec 21 2018, 10:59 AM
Post#1



Posts: 995
Joined: 27-July 05



Hi all,

I have a vbs file that opens up my access database. The main form that opens up on DB open has this command: DoCmd.RunCommand acCmdAppMaximize and seems to work just fine when I open the db directly. It maximizes the actual access app.

However when I open the same db via VBS, it doesn't maximize it

CODE
Function OpenDB(sRemoteDB, sLocalDB)

Dim bRun
Dim o


If FileExits(sLocalDB) = False Then
    If FileExits(sRemoteDB) = True Then
        bRun = CopyFileTo(sRemoteDB, sLocalDB)
    Else
        bRun = False
    End If
Else
    bRun = True
End If

If bRun Then
    
    bRun = CopyFileTo(sRemoteDB, sLocalDB)

    If bRun Then
        Set WshShell = CreateObject("WScript.Shell")
        If Len(sWorkGroupFile & "") > 0 Then
        'WshShell.Run "MSAccess.exe " & Chr(34) & sLocalDB & Chr(34)
    Set o = CreateObject("Access.Application")
    o.AutomationSecurity = 1 ' set macro security LOW.
    o.OpenCurrentDatabase sLocalDB
    o.RunCommand acCmdAppMaximize
    o.UserControl = True
    Set o = Nothing


       Else
        'WshShell.Run "MSAccess.exe " & Chr(34) & sLocalDB & Chr(34)
    Set o = CreateObject("Access.Application")
    o.AutomationSecurity = 1 ' set macro security LOW.
    o.OpenCurrentDatabase sLocalDB    
    o.RunCommand acCmdAppMaximize
    o.UserControl = True
    Set o = Nothing



       End If
     End If
    
    If bRun Then
        bRun = (Err.Number = 0)
    End If
End If
OpenDB = bRun

End Function
Go to the top of the page
 
 
Start new topic
Replies
cheekybuddha
post Dec 21 2018, 11:08 AM
Post#2


UtterAccess VIP
Posts: 11,296
Joined: 6-December 03
From: Telegraph Hill


Hi,

Try changing:
CODE
' ...
    o.RunCommand acCmdAppMaximize
' ...

to:
CODE
' ...
    o.DoCmd.RunCommand acCmdAppMaximize
' ...

--------------------


Regards,

David Marten
Go to the top of the page
 
ry94080
post Dec 21 2018, 11:23 AM
Post#3



Posts: 995
Joined: 27-July 05



Figured it out!!!!!

Had to define a constant

const acCmdAppMaximize = 10
Go to the top of the page
 
cheekybuddha
post Dec 21 2018, 11:24 AM
Post#4


UtterAccess VIP
Posts: 11,296
Joined: 6-December 03
From: Telegraph Hill


thumbup.gif

--------------------


Regards,

David Marten
Go to the top of the page
 

Posts in this topic
- ry94080   Vbs To Open Access Maxmized   Dec 21 2018, 10:59 AM
- - cheekybuddha   Hi, Try changing: CODE' ... o.RunCommand acC...   Dec 21 2018, 11:08 AM
|- - ry94080   Figured it out!!!!! Had to de...   Dec 21 2018, 11:23 AM
|- - cheekybuddha   RE: Vbs To Open Access Maxmized   Dec 21 2018, 11:24 AM
- - ry94080   Tried. No luck.   Dec 21 2018, 11:19 AM



Custom Search


RSSSearch   Top   Lo-Fi    20th June 2019 - 08:11 AM