So far I have the following in a .vbs file it works with one exception. It
opens the database but not in full view "Maximized". what is needed to fix
this so it will open in full view?
Thanks in advance.
Alvin
*******Script start*************
' VBS Script to look up upcoming birthday
Const pathMDBFile = "C:\Documents and Settings\Owner\Desktop\Family
Database\Family.mdb"
Const qdfBirthdaysDue = "Birthdays1"
' dao constants
Const dbOpenSnapshot = 4
Const dbForwardOnly = 8
Dim dbe, db, ss ' as DBEngine, as Database, as Recordset
Dim displayText ' as string
Dim lngRetval
' create a db engine
Set dbe = CreateObject("DAO.DBEngine.36")
' open the database readonly
Set db = dbe.OpenDatabase(pathMDBFile, False, True)
' get a snapshot of the data
set ss = db.OpenRecordset(qdfBirthdaysDue, dbOpenSnapshot, dbForwardOnly)
' run through any records that may have been returned
Do While Not ss.EOF
' create a simple string, just concatenate the names
' blank lines are ugly
If Len(displayText) > 0 Then displayText = displayText + vbNewLine +
vbNewLine
displayText = displayText & ss.Fields(0).Value & "'s Birthday is " &
ss.Fields(1).Value & " and will be "& ss.Fields(3).Value &" Years Old this
year!"
ss.MoveNext
Loop
' an empty MsgBox is so unhelpful: use some default text instead!
If Len(displayText) = 0 Then displayText = "There are No birthdays within
the next 30 days"
' tell the user
WScript.Echo displayText
' arrange for a neat closedown
ss.Close
db.Close
if vbYes = MsgBox( "Do you want to open Family Database ?", vbYesNo or
vbQuestion, "AddCustomTool.vbs") then
Dim objAccess
Dim strPathToMDB
strPathToMDB = "C:\Documents and Settings\Owner\Desktop\Family
Database\Family.mdb", vbMaximizedFocus
' For Access 2000, use Application.9
Set objAccess = CreateObject("Access.Application")
objAccess.OpenCurrentDatabase(strPathToMDB)
Set objAccess = Nothing
end if
' ***** End of script *****
David Lloyd - 31 Dec 2005 15:12 GMT
Alvin:
If you want to maximize the Access application window, one alternative would
be to use the following code after calling the OpenCurrentDatabase method:
objAccess.DoCmd.RunCommand acCmdAppMaximize

Signature
David Lloyd
MCSD .NET
http://LemingtonConsulting.com
This response is supplied "as is" without any representations or warranties.
So far I have the following in a .vbs file it works with one exception. It
opens the database but not in full view "Maximized". what is needed to fix
this so it will open in full view?
Thanks in advance.
Alvin
*******Script start*************
' VBS Script to look up upcoming birthday
Const pathMDBFile = "C:\Documents and Settings\Owner\Desktop\Family
Database\Family.mdb"
Const qdfBirthdaysDue = "Birthdays1"
' dao constants
Const dbOpenSnapshot = 4
Const dbForwardOnly = 8
Dim dbe, db, ss ' as DBEngine, as Database, as Recordset
Dim displayText ' as string
Dim lngRetval
' create a db engine
Set dbe = CreateObject("DAO.DBEngine.36")
' open the database readonly
Set db = dbe.OpenDatabase(pathMDBFile, False, True)
' get a snapshot of the data
set ss = db.OpenRecordset(qdfBirthdaysDue, dbOpenSnapshot, dbForwardOnly)
' run through any records that may have been returned
Do While Not ss.EOF
' create a simple string, just concatenate the names
' blank lines are ugly
If Len(displayText) > 0 Then displayText = displayText + vbNewLine +
vbNewLine
displayText = displayText & ss.Fields(0).Value & "'s Birthday is " &
ss.Fields(1).Value & " and will be "& ss.Fields(3).Value &" Years Old this
year!"
ss.MoveNext
Loop
' an empty MsgBox is so unhelpful: use some default text instead!
If Len(displayText) = 0 Then displayText = "There are No birthdays within
the next 30 days"
' tell the user
WScript.Echo displayText
' arrange for a neat closedown
ss.Close
db.Close
if vbYes = MsgBox( "Do you want to open Family Database ?", vbYesNo or
vbQuestion, "AddCustomTool.vbs") then
Dim objAccess
Dim strPathToMDB
strPathToMDB = "C:\Documents and Settings\Owner\Desktop\Family
Database\Family.mdb", vbMaximizedFocus
' For Access 2000, use Application.9
Set objAccess = CreateObject("Access.Application")
objAccess.OpenCurrentDatabase(strPathToMDB)
Set objAccess = Nothing
end if
' ***** End of script *****
TC - 31 Dec 2005 16:08 GMT
He says it's a VBScript, so he will have to define acCmdAppMaximize:
const acCmdAppMaximize = 10
HTH,
TC