Why can't Access find my table?

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
 
T

Tom

That did it. Thanks! (But I'd *swear* that I had tried that...and it didn't
work... <He says as he scratches his head in disbelief...> :)

Many thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top