Question : Report producing #Error in Text Box

I have a report with a text box with the following code from the control source:

=IIf(InStr(1,[PNotes],"Balance Rx")>0 And IsNull([ODSph]),[OSAxis],[ODAxis])

When ODSph is null and Balance Rx is in PNotes I am getting the value of OSAxis... but when ODSph is null and there Balance Rx is NOT in PNotes I'm getting an error display in the text box of #ERROR.  If I just have ODAXis in the text box is is left blank without an error on the report.  OSAxis is an integer.  I've tried using Nz but that didn't help.  Any ideas?

Answer : Report producing #Error in Text Box

>If I remove the formula and just use OSAxis I do not get the error and as expected the field is blank in the form.  Go figure.<
A textbox is a variant data type so it will accept a null value without error.

>It is blank, null no value has been entered. <
blank, null and no value are three very different things.

I get no error when I put
=IIf(InStr(1,"nothing","Balance Rx")>0 And IsNull(Null),5,Null)
 in the control source of a textbox. There must be something else going on with your problem.  Make sure your textbox is not named PNotes, ODSph, OSAxis or ODAxis.  A control cannot have the same name of a reference in the equation in its control source.
Random Solutions  
 
programming4us programming4us