Ok here are the event codes I found that may be relevant to the opening sequence of my database. The first form that opens is a splash screen. Kind of like a loading screen for a few seconds. Here are the events that trigger for the splash screen:
Code:
Private Sub Form_Open(Cancel As Integer)
DoCmd.ShowToolbar "Ribbon", acToolbarNo
fActivateControlBox (False)
fSetAccessWindow (SW_SHOWMINIMIZED)
End Sub
Code:
Private Sub Form_Timer()
DoCmd.Close
DoCmd.OpenForm "Login"
End Sub
Then once the splash screen closes and the login form opens, here is the code that I found for the login form:
Code:
Private Sub Form_Current()
Me.txtUsername = UCase(Me.txtUsername)
End Sub
Code:
Private Sub Form_Open(Cancel As Integer)
DoCmd.GoToRecord , , acNewRec
Me.txtUsername.SetFocus
End Sub
Code:
Private Sub Form_Close()
If Me.Dirty Then
Me.Undo
Exit Sub
End If
End Sub
Code:
Private Sub Form_Unload(Cancel As Integer)
If Me.Dirty Then
Me.Undo
Exit Sub
End If
If IsNull(Me.txtUsername) And IsNull(Me.txtPassword) Then
Me.Undo
Exit Sub
End If
If IsNull(Me.txtUsername) Or IsNull(Me.txtPassword) Then
Exit Sub
Else
[Forms]![Login]![txtLogoutDateTime] = Now()
End If
End Sub
Not sure if the close event does anything because I just added that to see if it would resolve the issue of saving blank records but nothing changed since I added it so that probably can be removed. I was just trying to insert more Me.Undo lines because that seems to be the function that takes care of unwanted saved records if the user clicks the Quit button on the login form which is simply this:
Code:
Private Sub cmdQuitApp_Click()
Me.Undo
DoCmd.Quit
End Sub
When the user clicks the Quit button then no record is saved regardless if I type credentials or not. So whether the form is dirty or not, the quit button (probably the Me.Undo) makes it so that no record is saved. But if I close the app by taskbar, no matter what, if I type credentials or not, the record will save reflecting what I type or don't type. What doesn't make sense is that if a form is NOT Dirty, how can it save it as a record to begin with? How can an autonumber be assigned to a record if the user doesn't type anything to make the form Dirty?