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

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> 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
 
cheekybuddha
post Dec 21 2018, 11:08 AM
Post#2


UtterAccess VIP
Posts: 11,289
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:19 AM
Post#3



Posts: 995
Joined: 27-July 05



Tried. No luck.

confused.gif
Go to the top of the page
 
ry94080
post Dec 21 2018, 11:23 AM
Post#4



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#5


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


thumbup.gif

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


Regards,

David Marten
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    17th June 2019 - 06:09 PM