Default Value in text boxes?

bsnapool

Registered User.
Local time
Today, 15:39
Joined
Nov 17, 2006
Messages
96
Hi All,

I am wondering what to do to put a default value in feilds which are blank. Would like a default value of 0. There is no default value in the properties of the bound text box in report view???
 
if you set the default at the table level i believe it will show in the report

or you can do

=iif(isnull(yourtextboxname),0,yourtextboxname)
 
Hey,

Thanks for your reply, will try and let you know how i get on.

Cheers
 
You can change the ControlSource of the bound textbox to:
=Iff(IsNull[YourField],0,[YourField])
...using YourField name of course.
 
I sure do Ray. Thanks for the catch. My << AIR CODE >> skills need some work! ;)
 
Hi All,

i tried this...

=IIf(IsNull([SumOfBudget Admissions]),0,([SumOfBudget Admissions]))

But coming up with an error???

Any ideas? The above formulae was in the detail of the report.
 
I have also tried setting the default value in a table, but because its a linked excel spreadsheet it wont allow the changes.

Is vba an option?
 
Hi All,

i tried this...

=IIf(IsNull([SumOfBudget Admissions]),0,([SumOfBudget Admissions]))

But coming up with an error???

Any ideas? The above formulae was in the detail of the report.
...What error?
 
You have this as the ControlSource of a TextBox in the Detail section of your report and it displays #Error# instead of a value, correct? It works as described previously when bound to [SumOfBudget Admissions] correct?
 
What is the data type of the [SumOfBudget Admissions] field?
 
You have this as the ControlSource of a TextBox in the Detail section of your report and it displays #Error# instead of a value, correct? It works as described previously when bound to [SumOfBudget Admissions] correct?

CORRECT

What is the data type of the [SumOfBudget Admissions] field?

The datatype is a number, this field is from a query.??
 
Do you have the "=" just prior to the IIF?? You are certain some of the fields are Null?
 
Do you have the "=" just prior to the IIF?? You are certain some of the fields are Null?

Yes I have the = sign before the iif statement. The are most definatly nulls.

Its a join from 2 tables, there will be some data in one table and none in the other table.

That make sense?
 
Sorry for asking such basic questions. What happens if you change the ControlSource to:
=IIf(IsNull([SumOfBudget Admissions]),"0",([SumOfBudget Admissions]))
 
I have just tried this and it coming up with an error:

Cost Difference: IIf([SumOfBudget Cost]="",[BasicCost],([BasicCost]-[SumOfBudget Cost]))

This way if it is another field has a a null value then i would like to place a value of Basic cost otherwise do the calcualtion...

Sorry about this but its winding me up...
 

Users who are viewing this thread

Back
Top Bottom