V
Vylent Fyre
In creating a log that will track each user's entering and exiting the
database, I followed the link provided by Gunny (Thanks so much, Gunny!) -
http://www.access.qbuilt.com/html/session_logs.html
And I've implemented all the necessary steps. There's only one "oddity" for
my database - I currently have to use a frm_Welcome_Menu that everyone has to
have opened 1st. What I did was I put an Event Procedure in the event "On
Open" which, I was hoping, would call the frmHidden and then proceed with the
rest of the coding. Below is my "On Open" event procedure.
DoCmd.OpenForm "frmHidden", , , , , acHidden
On Error GoTo ErrHandler
DoCmd.GoToRecord acDataForm, Me.Name, acNewRec
Me!txtUserName.Value = CurrentUser()
Me!txtComputerName.Value = CurrentObjectName()
Me!txtBeginTime.Value = Now()
RunCommand acCmdSaveRecord
Exit Sub
ErrHandler:
MsgBox "Error in Form_Open( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
End Sub
Then, in the "On Unload" Event Procedure, I have the following -
Private Sub Form_Unload(Cancel As Integer)
On Error GoTo ErrHandler
DoCmd.OpenForm "frmHidden", , , , , acHidden
Me!txtEndTime.Value = Now()
Exit Sub
ErrHandler:
If (Err.Number = 2448) Then
' Ignore, since the form is going into Design View.
Else
MsgBox "Error in Form_Unload( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
End If
Err.Clear
End Sub
I've saved everything and reopened the database - Whenever I try to close
the Welcome Screen (to exit) I get the following error -
Error in Form_Unload() in
frm_Welcome_Screen form.
Error # 2465
Microsoft Access can't find the field "txtEndTime" referred to in your
expression.
I've double checked and ensured that my text control box for this field is
named "txtEndTime" - Promise!
I know this is a simple fix and I'm obviously overlooking something simple;
would anyone mind pointing out my flaw(s)?
As always, I greatly appreciate each of your input and assistance on this
matter!
VF
database, I followed the link provided by Gunny (Thanks so much, Gunny!) -
http://www.access.qbuilt.com/html/session_logs.html
And I've implemented all the necessary steps. There's only one "oddity" for
my database - I currently have to use a frm_Welcome_Menu that everyone has to
have opened 1st. What I did was I put an Event Procedure in the event "On
Open" which, I was hoping, would call the frmHidden and then proceed with the
rest of the coding. Below is my "On Open" event procedure.
DoCmd.OpenForm "frmHidden", , , , , acHidden
On Error GoTo ErrHandler
DoCmd.GoToRecord acDataForm, Me.Name, acNewRec
Me!txtUserName.Value = CurrentUser()
Me!txtComputerName.Value = CurrentObjectName()
Me!txtBeginTime.Value = Now()
RunCommand acCmdSaveRecord
Exit Sub
ErrHandler:
MsgBox "Error in Form_Open( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
End Sub
Then, in the "On Unload" Event Procedure, I have the following -
Private Sub Form_Unload(Cancel As Integer)
On Error GoTo ErrHandler
DoCmd.OpenForm "frmHidden", , , , , acHidden
Me!txtEndTime.Value = Now()
Exit Sub
ErrHandler:
If (Err.Number = 2448) Then
' Ignore, since the form is going into Design View.
Else
MsgBox "Error in Form_Unload( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
End If
Err.Clear
End Sub
I've saved everything and reopened the database - Whenever I try to close
the Welcome Screen (to exit) I get the following error -
Error in Form_Unload() in
frm_Welcome_Screen form.
Error # 2465
Microsoft Access can't find the field "txtEndTime" referred to in your
expression.
I've double checked and ensured that my text control box for this field is
named "txtEndTime" - Promise!
I know this is a simple fix and I'm obviously overlooking something simple;
would anyone mind pointing out my flaw(s)?
As always, I greatly appreciate each of your input and assistance on this
matter!
VF