Is this possible with a textbox

S

steveatdb

I have a text box that is currently set up so that it has a control source of
a query and takes the value of a cell in a table.
What I would like to happen is that if the qry does not find a value then
the text box is assigned the value -1, if it does find the value however I
would like it to take on that value.
Thanks
-Steve
 
J

Jon Lewis

I presume you mean a control source of a field in a query?

You can use IIf in the query so in place of MyField in the Field row put
something like:
Expr1: IIf(IsNull([MyField]),-1,[MyField]) and make Expr1 the control source
of your text box

Look up IIF in help to see how it works

HTH
 
S

steveatdb

Thanks Jon
I found some information on the Nz Function and ended up using that.
Thanks again.

Jon Lewis said:
I presume you mean a control source of a field in a query?

You can use IIf in the query so in place of MyField in the Field row put
something like:
Expr1: IIf(IsNull([MyField]),-1,[MyField]) and make Expr1 the control source
of your text box

Look up IIF in help to see how it works

HTH


steveatdb said:
I have a text box that is currently set up so that it has a control source
of
a query and takes the value of a cell in a table.
What I would like to happen is that if the qry does not find a value then
the text box is assigned the value -1, if it does find the value however I
would like it to take on that value.
Thanks
-Steve
 
Top