Creating shortcuts to open Access DB with diff Forms
Posted: 17 Mar 2011, 11:31
Hi - This is not working for me and I hope someone can tell me what I am doing wrong.
I have the database loading with no forms opening.
I have created a short cut with the following path/command:
"C:\Documents and Settings\Administrator\Desktop\Assure2010 Lynn.mdb" /cmd="As"
I have an AutoExec macro with the following in it
RunCode CheckCommandLine()
I have a module called Module_Our_Command_Parser
Public Function CheckCommandLine() As Boolean
CheckCommandLine = True
If Len(Trim(Command)) = 0 Then Exit Function ' this is a regular open
Dim iPos As Integer
Dim sMyCommand As String
iPos = InStr(Command, "=")
sMyCommand = Trim(Mid(Command, iPos + 1))
sMyCommand = Mid(sMyCommand, 2)
iPos = Len(sMyCommand)
If iPos < 0 Then iPos = 1
sMyCommand = Mid(sMyCommand, 1, iPos - 1)
Select Case sMyCommand
Case "As"
DoCmd.OpenForm "frmAssure"
Case "Ed"
DoCmd.OpenForm "frmCourses"
End Select
End Function
The code doesn't run but the macro does (tested it by adding a MsgBox at the end of it)
The database opens but doesn't show any forms. The Database is password protected but this should not affect the AutoExec Macro.
Please - what have I done wrong or what am I forgetting?
I have the database loading with no forms opening.
I have created a short cut with the following path/command:
"C:\Documents and Settings\Administrator\Desktop\Assure2010 Lynn.mdb" /cmd="As"
I have an AutoExec macro with the following in it
RunCode CheckCommandLine()
I have a module called Module_Our_Command_Parser
Public Function CheckCommandLine() As Boolean
CheckCommandLine = True
If Len(Trim(Command)) = 0 Then Exit Function ' this is a regular open
Dim iPos As Integer
Dim sMyCommand As String
iPos = InStr(Command, "=")
sMyCommand = Trim(Mid(Command, iPos + 1))
sMyCommand = Mid(sMyCommand, 2)
iPos = Len(sMyCommand)
If iPos < 0 Then iPos = 1
sMyCommand = Mid(sMyCommand, 1, iPos - 1)
Select Case sMyCommand
Case "As"
DoCmd.OpenForm "frmAssure"
Case "Ed"
DoCmd.OpenForm "frmCourses"
End Select
End Function
The code doesn't run but the macro does (tested it by adding a MsgBox at the end of it)
The database opens but doesn't show any forms. The Database is password protected but this should not affect the AutoExec Macro.
Please - what have I done wrong or what am I forgetting?