Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

will not eval a function name from a table.

18 views
Skip to first unread message

bipin

unread,
Dec 10, 2009, 3:57:40 PM12/10/09
to
Hello,

I have a table of reports and the functions that must run
before the report is opened.

Set db = DBEngine(0)(0)
sSQL = "SELECT DISTINCTROW tblReportSelect.CompanyID, " & _
"tblReports.ReportID, tblReports.ReportName, " & _
"tblReports.ActualName, tblReports.FuncName " & _
"FROM tblReportSelect INNER JOIN tblReports ON " & _
"tblReportSelect.ReportID = tblReports.ReportID " & _
"WHERE (((tblReportSelect.CompanyID)=" & [Forms]!
[frmReports]![cboComp] & "));"

Set rsReports = db.OpenRecordset(sSQL, dbOpenSnapshot)

Do Until rsReports.EOF
If Not IsNull(rsReports!FuncName) Then
Debug.Print rsReports!FuncName
' errors here:
Eval (rsReports!FuncName)
End If

DoCmd.OpenReport (rsReports!ActualName), A_NORMAL ' A_PREVIEW
DoEvents
rsReports.MoveNext
Loop
rsReports.Close

now the eval function will not run the function. the same code works
fine
in AC97. but in AC2007 i get the following error:

Run-time error '2482':

Microsoft Office Access can't find the name 'ClassMerchPrep' you
entered
in the expression.

the function runs fine outside of the eval function. Are there any
alternatives
to the eval function?

Thanks,

Bipin

Tom van Stiphout

unread,
Dec 10, 2009, 11:12:01 PM12/10/09
to
On Thu, 10 Dec 2009 12:57:40 -0800 (PST), bipin <bipin...@gmail.com>
wrote:

Eval still works the same way as before.
When the error occurs, hit Ctrl+Break to break into the code. Then
inspect the value of rsReports!FuncName
I bet it's not what you were expecting.

-Tom.
Microsoft Access MVP

0 new messages