J
JohnE
I am trying to put together a function for error logging into an sql2005
table. The function will be in the front end of the application. Below is
what I have so far that is getting me frustrated. Originally, I had a stored
procedure to with the insert which when executed worked fine. Most of it is
below the execute line. I am trying to move it into the front end. As of
now, I'm not even sure if I'm on the right path or not. The INSERT INTO is
the table and the field. The ErrorDate is a datetime and ApplicationSignon
is a bit. The remaining fields are varchar.
Function ErrorLog(module As String, event_procedure As String, Optional
application_signon As Boolean)
Dim error_date As Date
Dim user_name As String
Dim computer_name As String
Dim Form As String
Dim control As String
error_date = Now()
user_name = gUsername
computer_name = Environ("ComputerName")
error_number = err.Number
error_description = err.Description
'module =
Form = Screen.ActiveForm.Name
control = Screen.ActiveControl
'event_procedure =
'application_signon =
Call CurrentProject.Connection.Execute_
INSERT INTO ErrorLog
(ErrorDate,
UserName,
ComputerName,
ErrorNumber,
ErrorDescription,
Module,
Form,
Control,
EventProcedure,
ApplicationSignon)
Values
(GetDate(),
@username,
@computername,
@errornumber,
@errordescription,
@module,
@form,
@control,
@eventprocedure,
@applicationsignon)
End Function
I ask if someone can look at this and undo the jumbled mess.
Thanks...John
table. The function will be in the front end of the application. Below is
what I have so far that is getting me frustrated. Originally, I had a stored
procedure to with the insert which when executed worked fine. Most of it is
below the execute line. I am trying to move it into the front end. As of
now, I'm not even sure if I'm on the right path or not. The INSERT INTO is
the table and the field. The ErrorDate is a datetime and ApplicationSignon
is a bit. The remaining fields are varchar.
Function ErrorLog(module As String, event_procedure As String, Optional
application_signon As Boolean)
Dim error_date As Date
Dim user_name As String
Dim computer_name As String
Dim Form As String
Dim control As String
error_date = Now()
user_name = gUsername
computer_name = Environ("ComputerName")
error_number = err.Number
error_description = err.Description
'module =
Form = Screen.ActiveForm.Name
control = Screen.ActiveControl
'event_procedure =
'application_signon =
Call CurrentProject.Connection.Execute_
INSERT INTO ErrorLog
(ErrorDate,
UserName,
ComputerName,
ErrorNumber,
ErrorDescription,
Module,
Form,
Control,
EventProcedure,
ApplicationSignon)
Values
(GetDate(),
@username,
@computername,
@errornumber,
@errordescription,
@module,
@form,
@control,
@eventprocedure,
@applicationsignon)
End Function
I ask if someone can look at this and undo the jumbled mess.
Thanks...John