Reputation: 1
Building forms in Microsoft Access 2013. As the title says, Public Sub FormLoad() 'Do Stuff! End Sub does not fire. I am completely mystified. Extensive Googling has shown that other people have had this problem, but it was caused by subforms and other complexities that I am not dealing with.
This form's full code is below:
Option Compare Database
Private Sub FormLoad()
Me.Label6.Caption = PrevForm
MsgBox "Main Form/Form Load has Fired!"
'Set previous form to the last form open and reset "this form" to ME
PrevForm = ThisForm
ThisForm = Me.Name
End Sub
Private Sub CmdMngDbCreateEvent_Click()
PrevForm = Me.Name
DoCmd.OpenForm "CreateEvent"
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub
Private Sub CmdMngDbManageEvents_Click()
PrevForm = Me.Name
DoCmd.OpenForm "ManageEvents"
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub
Private Sub CmdMngDbUploadRoster_Click()
PrevForm = Me.Name
DoCmd.OpenForm "UploadRoster"
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub
Private Sub CmdMngDbManagePersonnel_Click()
PrevForm = Me.Name
DoCmd.OpenForm "ManagePersonnel"
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub
Private Sub CmdMngDbMainMenu_Click()
PrevForm = Me.Name
DoCmd.OpenForm "Home"
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub
Obviously, this is an exceedingly simple form. The only objects on the form are the objects referenced in the code, and everything other than FormLoad() works as intended.
Any ideas? I'm utterly stumped.
Upvotes: 0
Views: 177
Reputation: 27644
It's
Private Sub Form_Load()
not
Private Sub FormLoad()
Always build Event procedures via the property sheet or the dropdowns in the VBE, don't type them by hand.
Upvotes: 2