If textbox = #Error

  • Thread starter Thread starter skusey
  • Start date Start date
S

skusey

I have a textbox in a report and basically the textbox is calculating a
figure from the report and then adding it together with a figure from a
subreport.

My idea is to say something similar to:

If textbox equals #error then textbox.visible = false

I cannot for the life of me work out how I can get this written into my
code. Is there anyone out there that can help me with this?
 
skusey said:
I have a textbox in a report and basically the textbox is calculating a
figure from the report and then adding it together with a figure from a
subreport.

My idea is to say something similar to:

If textbox equals #error then textbox.visible = false

I cannot for the life of me work out how I can get this written into my
code. Is there anyone out there that can help me with this?

"#error" is being caused by one or more calculations not being evaluated.
For example, if you have a field containing a null and you're including this
field in a calc, you need to code accordingly. Off the top of my head:

If IsNull(Me.txtMyTextBox1) Or IsNull(Me.txtMyTextBox2) Then
Me.txtMyTextBox3.Visible = False
Else ...

HTH - Keith.
www.keithwilby.com
 
skusey said:
I have a textbox in a report and basically the textbox is calculating a
figure from the report and then adding it together with a figure from a
subreport.

My idea is to say something similar to:

If textbox equals #error then textbox.visible = false


The usual reason for getting #Error from a subreport
reference is that the subreport has no records and hence no
value. The way to deal with this is in the main report's
text box's expression with something like:

=X+Y+IIf(subreport.Report.HasData,subreport.Report.Z, 0)
 
Sorry mate, any chance you could explain what the above code means? I
am an absolute beginner at coding in Access as you can probably tell
and I can't work out how this fits into my code.

Cheers.
 
skusey said:
Sorry mate, any chance you could explain what the above code means? I
am an absolute beginner at coding in Access as you can probably tell
and I can't work out how this fits into my code.


I'd be glad to, but I would need to see the expression you
are using that produces #Error along with a brief
explanation of what each name refers to.

The general idea is to see if that subreport has any data to
total, and use 0 if not. The X and Y represent some control
names in your main report and Z represents the name of the
total text box in the subreport.
 
Back
Top