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?
Creating shortcuts to open Access DB with diff Forms
-
- Registered User
- Posts: 20576
- Joined: 19 Sep 2003, 02:00
- Location: Bloodbank
Re: Creating shortcuts to open Access DB with diff Forms
Put in MsgBox statements to show what the value of sMyCommand is before and after each change you are making to it. Should show you if something funny happens with the parsing of the command line.
- Spoiler (show)
- Tribble
- Registered User
- Posts: 88465
- Joined: 08 Feb 2007, 02:00
- Processor: Intel Core i7-4770K CPU@3.50GHz
- Motherboard: ACPI x64-based PC
- Graphics card: GeForce GTX 780 Ti
- Memory: 16GB
- Location: Not here
- Contact:
Re: Creating shortcuts to open Access DB with diff Forms
Will try that thanks.
Got a work around though (read cheat). I have created a form with both logos and use macros to close the form and load the relevant part of the program when they click on their logo.
Still want to find out what I have missed though.
Got a work around though (read cheat). I have created a form with both logos and use macros to close the form and load the relevant part of the program when they click on their logo.
Still want to find out what I have missed though.