T
Tom
I have a function:
Public Function fncLogRunHistory2(strTableName As String) As Boolean
On Error GoTo Err_LogRunHistory2
SysCmd acSysCmdSetStatus, ("Logging Run History...")
Set DAOdbs = CurrentDb
'------------------------------------------------------------
'
' Make the 'RunHistory' table entry
'
Set DAOrs = DAOdbs.OpenRecordset(strTableName)
DAOrs.AddNew
strCurrentUser = Environ$("UserName")
StopTime = Time
ElapsedSeconds = DateDiff("s", StartTime, StopTime)
ElapsedTime = ElapsedSeconds \ 60 & ":" & Format(ElapsedSeconds Mod 60,
"00")
DAOrs![TimeStamp] = Now()
If Len(strCurrentUser) > 0 Then
DAOrs![User] = strCurrentUser
End If
DAOrs![StartTime] = Time
DAOrs![StartTime] = StartTime
DAOrs![StopTime] = StopTime
DAOrs![ElapsedTime] = ElapsedTime
DAOrs.Update
DAOrs.Close
Set DAOrs = Nothing
DAOdbs.Close
Set DAOdbs = Nothing
Exit_LogRunHistory2:
On Error Resume Next
SysCmd acSysCmdClearStatus
Exit Function
Err_LogRunHistory2:
MsgBox "Error # " & Err.Number & " was generated by " & Err.Source & vbCrLf
& _
Err.Description, , "RunJob - LogRunHistory2 - " & Date & " - " &
Time
' intRunJobLElecRpt4Andy = False
Resume Exit_LogRunHistory2
End Function
'------------------------------------------------------------
That I call like this (from my macro):
fncLogRunHistory2(tblRevenue_CIS_RunHistory)
What I get from Access is:
"Microsoft Access can't find the name 'tblRevenue_CIS_RunHistory' you entered in
the expression."
What am I doing wrong?
Thanks in advance,
Tom
Public Function fncLogRunHistory2(strTableName As String) As Boolean
On Error GoTo Err_LogRunHistory2
SysCmd acSysCmdSetStatus, ("Logging Run History...")
Set DAOdbs = CurrentDb
'------------------------------------------------------------
'
' Make the 'RunHistory' table entry
'
Set DAOrs = DAOdbs.OpenRecordset(strTableName)
DAOrs.AddNew
strCurrentUser = Environ$("UserName")
StopTime = Time
ElapsedSeconds = DateDiff("s", StartTime, StopTime)
ElapsedTime = ElapsedSeconds \ 60 & ":" & Format(ElapsedSeconds Mod 60,
"00")
DAOrs![TimeStamp] = Now()
If Len(strCurrentUser) > 0 Then
DAOrs![User] = strCurrentUser
End If
DAOrs![StartTime] = Time
DAOrs![StartTime] = StartTime
DAOrs![StopTime] = StopTime
DAOrs![ElapsedTime] = ElapsedTime
DAOrs.Update
DAOrs.Close
Set DAOrs = Nothing
DAOdbs.Close
Set DAOdbs = Nothing
Exit_LogRunHistory2:
On Error Resume Next
SysCmd acSysCmdClearStatus
Exit Function
Err_LogRunHistory2:
MsgBox "Error # " & Err.Number & " was generated by " & Err.Source & vbCrLf
& _
Err.Description, , "RunJob - LogRunHistory2 - " & Date & " - " &
Time
' intRunJobLElecRpt4Andy = False
Resume Exit_LogRunHistory2
End Function
'------------------------------------------------------------
That I call like this (from my macro):
fncLogRunHistory2(tblRevenue_CIS_RunHistory)
What I get from Access is:
"Microsoft Access can't find the name 'tblRevenue_CIS_RunHistory' you entered in
the expression."
What am I doing wrong?
Thanks in advance,
Tom