Follow-up to DAO.Recordset as Report record source

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"""
 
M

Mark Andrews

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
 
D

Duane Hookom

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"""


.
 
S

Steve S

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

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