Boreal2009
Registered User.
- Local time
- Today, 13:49
- Joined
- Oct 5, 2009
- Messages
- 10
Hi Everyone,
I am VERY new to VBA so please bear with me! I am using Access 2003 and I have a form that when it is loaded it prompts the user to answer a yes or no question. When yes is selected I want the form to open in Edit mode and when no is selected I want the form to open in Add mode.
Below is the code that is attached to the On Load Event. It works perfectly when yes is selected and opens the form in Edit mode. However, when no is selected, the form still opens in Edit mode. I have tried the same code in the On Open Event with the same results. It should also be noted that the form contains a subform.
I searched around for the better part of a day to try and figure this out which is how I developed the code below. Can anyone provide me with detailed instructions on how to solve this problem?
Thanks in advance!
Private Sub Form_Load()
If MsgBox("Is this a Re-Capture?", vbYesNo + vbInformation, "Information Needed") = vbYes Then
DoCmd.RunMacro "Search Message MACRO"
DoCmd.RunCommand acCmdFind
Else
DoCmd.OpenForm "FORM - Male Capture Information", acNormal, , , acFormAdd, acWindowNormal, OpenArgs
End If
End Sub
I am VERY new to VBA so please bear with me! I am using Access 2003 and I have a form that when it is loaded it prompts the user to answer a yes or no question. When yes is selected I want the form to open in Edit mode and when no is selected I want the form to open in Add mode.
Below is the code that is attached to the On Load Event. It works perfectly when yes is selected and opens the form in Edit mode. However, when no is selected, the form still opens in Edit mode. I have tried the same code in the On Open Event with the same results. It should also be noted that the form contains a subform.
I searched around for the better part of a day to try and figure this out which is how I developed the code below. Can anyone provide me with detailed instructions on how to solve this problem?
Thanks in advance!
Private Sub Form_Load()
If MsgBox("Is this a Re-Capture?", vbYesNo + vbInformation, "Information Needed") = vbYes Then
DoCmd.RunMacro "Search Message MACRO"
DoCmd.RunCommand acCmdFind
Else
DoCmd.OpenForm "FORM - Male Capture Information", acNormal, , , acFormAdd, acWindowNormal, OpenArgs
End If
End Sub