L
ldiaz
Hi I'm using this code to get UserName and ComputerName of all user that
access to my DataBase.
this code is in the Form, also I have two modules named: fOSMachineName and
fOSUserName , the codes of these modules wre copied from www.mvps.org but I
don't know why it does not work,
could you help me, I will appreciate so much
ldiaz
______________________________________________
Option Compare Database
Private Sub form_Open(Cancel As Integer)
On Error GoTo ErrHandler
DoCmd.GoToRecord acDataForm, Me.Form, acNewRec
Me!UserName.Text = fOSUserName()
Me!ComputerName.Value = fOSMachineName()
Me!BeginTime.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
Private Sub form_Timer()
On Error GoTo ErrHandler
Me.Visible = False
Me.TimerInterval = 0
Exit Sub
ErrHandler:
MsgBox "Error in Form_Timer( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
End Sub
Private Sub form_Unload(Cancel As Integer)
On Error GoTo ErrHandler
Me!EndTime.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
access to my DataBase.
this code is in the Form, also I have two modules named: fOSMachineName and
fOSUserName , the codes of these modules wre copied from www.mvps.org but I
don't know why it does not work,
could you help me, I will appreciate so much
ldiaz
______________________________________________
Option Compare Database
Private Sub form_Open(Cancel As Integer)
On Error GoTo ErrHandler
DoCmd.GoToRecord acDataForm, Me.Form, acNewRec
Me!UserName.Text = fOSUserName()
Me!ComputerName.Value = fOSMachineName()
Me!BeginTime.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
Private Sub form_Timer()
On Error GoTo ErrHandler
Me.Visible = False
Me.TimerInterval = 0
Exit Sub
ErrHandler:
MsgBox "Error in Form_Timer( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
End Sub
Private Sub form_Unload(Cancel As Integer)
On Error GoTo ErrHandler
Me!EndTime.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