Reports: Control Source trouble...

J

Jamie Risk

I'm formatting a report based on a query. To make the report construction
simpler, my query is structured as:
SELECT [long_table_name].[longer_field_name] AS short_name ....

My problem is that in constructing my report in some instances of :
short_name
I've replaced with:
=[short_name]

With some text boxes I sometimes get "#error" showing up on the report. I
can flip back and forth between the two formats so I feel it's not a typo.
I've changed most of the report to avoid using the "=[]" format, but with
names it is particularly useful (i.e. =[Name] & " " & [Surname])

What gives?

- Jamie
 
D

Dirk Goldgar

Jamie Risk said:
I'm formatting a report based on a query. To make the report
construction simpler, my query is structured as:
SELECT [long_table_name].[longer_field_name] AS short_name ....

My problem is that in constructing my report in some instances of :
short_name
I've replaced with:
=[short_name]

With some text boxes I sometimes get "#error" showing up on the
report. I can flip back and forth between the two formats so I feel
it's not a typo. I've changed most of the report to avoid using the
"=[]" format, but with names it is particularly useful (i.e. =[Name]
& " " & [Surname])

What gives?

- Jamie

If a text box has the same name as a field in the report's recordsource,
then it must be bound to that field, not to an expression. You probably
took a control that was (for example) named "Surname" and bound to the
field Surname, and changed its controlsource to the expression "=[Name]
& " " & [Surname]". Now Access has trouble figuring out what [Surname]
is -- is it the control or the field? -- so it gives an error.

If this is the problem, just change the name of the text box, possibly
by adding the "txt" prefix.

BTW, do you really have controls bound to expressions like
"=[short_name]"? Why would you do that, instead of just binding the
control to "[short_name]"? I don't see the point.
 
J

Jamie Risk

Thanks, that fixed it.

I don't have controls bound to simple expressions like "=[field_name]", I
was juts able to reduce my error source the simplest expression.


Dirk Goldgar said:
Jamie Risk said:
I'm formatting a report based on a query. To make the report
construction simpler, my query is structured as:
SELECT [long_table_name].[longer_field_name] AS short_name ....

My problem is that in constructing my report in some instances of :
short_name
I've replaced with:
=[short_name]

With some text boxes I sometimes get "#error" showing up on the
report. I can flip back and forth between the two formats so I feel
it's not a typo. I've changed most of the report to avoid using the
"=[]" format, but with names it is particularly useful (i.e. =[Name]
& " " & [Surname])

What gives?

- Jamie

If a text box has the same name as a field in the report's recordsource,
then it must be bound to that field, not to an expression. You probably
took a control that was (for example) named "Surname" and bound to the
field Surname, and changed its controlsource to the expression "=[Name]
& " " & [Surname]". Now Access has trouble figuring out what [Surname]
is -- is it the control or the field? -- so it gives an error.

If this is the problem, just change the name of the text box, possibly
by adding the "txt" prefix.

BTW, do you really have controls bound to expressions like
"=[short_name]"? Why would you do that, instead of just binding the
control to "[short_name]"? I don't see the point.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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