Check to see if a field is blank?

KevinSlater

Registered User.
Local time
Today, 13:19
Joined
Aug 5, 2005
Messages
249
Hi,

I have the below formular field in a Crystal report but i need to modify the code so that on the part that says: {DATA_FORECAST_UPDATE.NEW_WEEKLY_BASE_FROM}=0 is changed to instead check to see if the field is blank instead of 0

I tried isnull which usaully works ok in Access but I cant seem to get this to work, please help.


if {DATA_FORECAST_UPDATE.END_WEEKLY_BASE_FROM}>=1 AND {DATA_FORECAST_UPDATE.NEW_WEEKLY_BASE_FROM}>1 or {DATA_FORECAST_UPDATE.NEW_WEEKLY_BASE_FROM}=0 Then {DATA_FORECAST_UPDATE.WEEKLY_BASE} else if {DATA_FORECAST_UPDATE.NEW_WEEKLY_BASE_FROM} <=1 and {DATA_FORECAST_UPDATE.END_WEEKLY_BASE_FROM} >=1 then {DATA_FORECAST_UPDATE.WEEKLY_BASE}+{DATA_FORECAST_UPDATE.NEW_WEEKLY_BASE} else 0

Thanks
Kevin
 
Hello,
The isnull thing should work if you follow this syntax:
if isnull({blah}) then 0

If you want to have another condition as well the isnull i'd enclose them both in brackets like:
if (isnull({blah}) AND {blahblah}>1) then ...

Man, that is one complicated formula. I've only been looking at for 10 minutes and already I think I need to go and lie down in a dark room for a bit. If it were me I'd use some variables if only to get around the rather long and very similar looking table-fieldname combinations.

Good luck,
Pete
 
You can also take care of nulls AND an empty string (which isn't a null) by using:

If Len({DATA_FORECAST_UPDATE.NEW_WEEKLY_BASE_FROM} & "") = 0 Then
 

Users who are viewing this thread

Back
Top Bottom