Default Value in text boxes? (1 Viewer)

bsnapool

Registered User.
Local time
Today, 14:50
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???
 

rainman89

I cant find the any key..
Local time
Today, 09:50
Joined
Feb 12, 2007
Messages
3,015
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)
 

bsnapool

Registered User.
Local time
Today, 14:50
Joined
Nov 17, 2006
Messages
96
Hey,

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

Cheers
 

RuralGuy

AWF VIP
Local time
Today, 07:50
Joined
Jul 2, 2005
Messages
13,825
You can change the ControlSource of the bound textbox to:
=Iff(IsNull[YourField],0,[YourField])
...using YourField name of course.
 

RuralGuy

AWF VIP
Local time
Today, 07:50
Joined
Jul 2, 2005
Messages
13,825
I sure do Ray. Thanks for the catch. My << AIR CODE >> skills need some work! ;)
 

bsnapool

Registered User.
Local time
Today, 14:50
Joined
Nov 17, 2006
Messages
96
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.
 

bsnapool

Registered User.
Local time
Today, 14:50
Joined
Nov 17, 2006
Messages
96
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?
 

RuralGuy

AWF VIP
Local time
Today, 07:50
Joined
Jul 2, 2005
Messages
13,825
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?
 

RuralGuy

AWF VIP
Local time
Today, 07:50
Joined
Jul 2, 2005
Messages
13,825
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?
 

RuralGuy

AWF VIP
Local time
Today, 07:50
Joined
Jul 2, 2005
Messages
13,825
What is the data type of the [SumOfBudget Admissions] field?
 

bsnapool

Registered User.
Local time
Today, 14:50
Joined
Nov 17, 2006
Messages
96
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.??
 

RuralGuy

AWF VIP
Local time
Today, 07:50
Joined
Jul 2, 2005
Messages
13,825
Do you have the "=" just prior to the IIF?? You are certain some of the fields are Null?
 

bsnapool

Registered User.
Local time
Today, 14:50
Joined
Nov 17, 2006
Messages
96
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?
 

RuralGuy

AWF VIP
Local time
Today, 07:50
Joined
Jul 2, 2005
Messages
13,825
Sorry for asking such basic questions. What happens if you change the ControlSource to:
=IIf(IsNull([SumOfBudget Admissions]),"0",([SumOfBudget Admissions]))
 

bsnapool

Registered User.
Local time
Today, 14:50
Joined
Nov 17, 2006
Messages
96
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

Top Bottom