Follow-up to DAO.Recordset as Report record source

  • Thread starter Thread starter Steve S
  • Start date Start date
S

Steve S

The following code opens the correct report but the field [Contest Name]
shows the #Name? error instead of ABC as needed. I am using AC2000: could
that be the problem?

this code was developed based on responses to a previous post: DAO.Recordset
as Report record source, posted on 10/13


Dim rst As DAO.Recordset

Set rst = Me.[Show Detail Records].Form.Recordset

DoCmd.OpenReport rst.Fields("ScoreSheetName"), acViewPreview, , "[Contest
Name]=""ABC"""
 
In the report that is being called look at the RecordSource and make sure
that you have a field called [Contest Name], also on the field on the report
should have control source of [Contest Name].

It's showing #name because it can't find that field in the report's
recordsource.

It looks like at runtime you are just providing the name of the report to
open, so the dao code is probably not the issue.

HTH,
Mark
 
You will get the #Name error if the name of your text box on the report is a
field name and the control source of the text box is a expression beginning
with "=".

Also, aren't you looping through the recordset? Did you just remove that
code to avoid confusion?

--
Duane Hookom
Microsoft Access MVP


Mark Andrews said:
In the report that is being called look at the RecordSource and make sure
that you have a field called [Contest Name], also on the field on the report
should have control source of [Contest Name].

It's showing #name because it can't find that field in the report's
recordsource.

It looks like at runtime you are just providing the name of the report to
open, so the dao code is probably not the issue.

HTH,
Mark

Steve S said:
The following code opens the correct report but the field [Contest Name]
shows the #Name? error instead of ABC as needed. I am using AC2000: could
that be the problem?

this code was developed based on responses to a previous post:
DAO.Recordset
as Report record source, posted on 10/13


Dim rst As DAO.Recordset

Set rst = Me.[Show Detail Records].Form.Recordset

DoCmd.OpenReport rst.Fields("ScoreSheetName"), acViewPreview, , "[Contest
Name]=""ABC"""


.
 
The problem is that I misinterpreted the use of the 'OpenArgs' parameter of
the DoCmd.OpenReport. The problem is ME.
 
Back
Top