Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detect empty string in Access

Status
Not open for further replies.

Hermanator

Technical User
Jan 16, 2002
30
0
0
NL
I have a strange problem in Access that has to do with a problem I have bothered you about earlier.

I want to make an [Event Procedure] which checks if a certain field is empty, and if empty places a certain text in it.
But I can't detect wether or not the field is empty. I have tried:
* If Me.address = "" then
* If LEN(Me.Address) = 0 then
* If Me.Address = Empty then
* If IsEmpty(Me.Address) then

It even doesn't work to use a NOT like this:
* If NOT ( LEN(Me.Address) > 0 ) ) then

Since the Address field is in fact an e-mail address, I have also tried to check wether the string contains a '@' character. But this also doesn't work.
All these solutions work correctly if the field isn't empty. But when the field is empty, nothing happens.
-> It seems that if the field is empty, the whole IF block is skipped!
The only solution that I can come up with is to check for the opposite condition, and if the expression satisfies the opposite condition it skippes the line in which the text in the field is replaced. But I couldn't do this since a GOTO command didn't work in an IF block.
I promised I wouldn't have to bother you again ;-) except I'm so puzzled about this !!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top