If IsNull problem in my form

christheancient

Registered User.
Local time
Today, 12:18
Joined
Dec 28, 2002
Messages
41
Working A97.

I am trying to use unbound boxes in a form to give conditional status messages about field entries.

These statements (to date) are checked as part of the form's On Current property.

I get good messages when the statement depends on a yes/no box or on detecting if a particular character (part of a phone number) was there like in the 'business fax bit of code below.

However, I want to build further on If IsNull to determine if a field is empty and raise a conditional statement in an unbound box as in the 'business e-mail bit of code below.

It works the first time I go into the form or change the statement state. but once the If IsNull is 'triggered' the statement won't go away when I change from one record to another.

I suspect my approach is far too simplistic (but then I've got a simple mind!) and that I probably need to play with the (xxxxxxx.value) bit. But A97 Help files don't much!

I attach some of the code (and the guilty bit).

'business fax (This bit works fine)

If Mid([BusinessFax], 2, 1) = "0" Then
If RevealFax = True Then
txtFaxReveal.ForeColor = RGB(0, 0, 0)
txtFaxReveal = "You may reveal this number"
Else
txtFaxReveal.ForeColor = RGB(255, 0, 0)
txtFaxReveal = "Number is NOT to be disclosed"
End If
Else: txtFaxReveal = ""

End If

'business e-mail (This is the problem bit)

If IsNull(BusinessEMail.Value) Then
txtBusinessEMailReveal = "Address not available"
End If


Where am I going wrong please?

TIA

Chris
 
Got it

It may not be pretty, but I've got this to work after a few hours of hair tearing!...

Dim mystring
mystring = [BusinessEMail]
txtBusinessEMailReveal = mystring
If Len(mystring) > 0 Then
txtBusinessEMailReveal = "Address not available"
End If

And then I shall just invert the logic of the conditional statements from there.

Thanks for trying folks.
 
Have you tried:

If IsNull(BusinessEMail) Then
txtBusinessEMailReveal.text = "Address not available"
End If
 
Hi jfg

Tried your idea - it looked good. Certainly neater and tidier than mine!

But the form didn't like it if the field didn't have focus. As the form has about 25 fields - and that ain't the prime field, I'm still stuck with my untidy idea at the moment.

Unless, of course, anyone knows different!

Chris
 
Try:
If IsNull(BusinessEMail) Then
me.txtBusinessEMailReveal.SetFocus
txtBusinessEMailReveal.text = "Address not available"
me.txtNameofPrimaryField.SetFocus
End If
 
See....

I said I was stoopid!

Easy when you think about it.

My excuse is that I've been working on this database since this morning and the brain cell is getting tired and suffering from alcohol withdrawal symptoms!

Chris
 

Users who are viewing this thread

Back
Top Bottom