quick question abt Null fields (1 Viewer)

shafh

Registered User.
Local time
Today, 02:00
Joined
Jun 23, 2003
Messages
27
Hi everyone,
I have a table that has a few records in 3 different fields that are empty. Is there any way I can get the table to show "EXCEPTION" in those records rather then leave it blank.
Thanks,
Sam
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:00
Joined
Feb 19, 2002
Messages
43,768
On a report it would be no problem. Either in the query or in one of the controls -
IIf(IsNull(Fld1), "Exception", Fld1)

However, a form is more of a problem because calculated fields (which is what this would be) are not updatable. You would need to hide the real field and use an unbound text box to handle data entry.
 

shafh

Registered User.
Local time
Today, 02:00
Joined
Jun 23, 2003
Messages
27
clarification

Thanks Pat,
I think I wrote my question wrong. I wanted the Table to show "Exception" in the empty records. You have mentioned how this could be done in a Report and Form. But is there any way to do this in the Tables view (i.e. when you open the table directly).
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:00
Joined
Feb 19, 2002
Messages
43,768
If the field in question is text and long enough to hold the word, you can make "Exception" the default value. That way if no value is entered, the default will be assigned. Otherwise there is no way.
As a point of good application design, you should NOT be using tables directly for anything. You should be using forms and reports with recordsources based on queries.
 

jaydwest

JayW
Local time
Today, 00:00
Joined
Apr 22, 2003
Messages
340
Instead of using IIF, you might use the NZ function. It's simpler and more direct. Code is


NZ(Fld1, "Exception")

:D
 

shafh

Registered User.
Local time
Today, 02:00
Joined
Jun 23, 2003
Messages
27
Thanks

Thanks a lot guys, especially Pat. Setting Default value to "Exception" did the trick.
Sam
 

Users who are viewing this thread

Top Bottom