A
Alvin
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 *****
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 *****