If..Then incorreclty sensing empty char string from Access 
Author Message
 If..Then incorreclty sensing empty char string from Access

In server-side code, I use a simple If......Then test:

If Lookup(parameter1, parameter2 etc.) = "" Then
 DoSomething
End If

Lookup is a home-made function that returns one of two values: either "" (if
no record is found), or a single Access field (which is allowed to have a
zero-length string value). (The field returned is defined as text, 255 char,
not required, zero-length permitted).

For some reason, when Lookup finds a record and this particular Access field
has a "" value,  the If..Then loop fails to trigger and DoSomething is never
done.  This effect is the same for {*filter*}al records whose particular Access
field has never had a value, as well as for those that have had a value in
the past but have now been set to "". I've checked out that what's being
returned really is "" by tests such as response.write "WW" & Lookup(bla bla
bla) & "WW"; IsNull() and IsEmpty() tests show False.

Any ideas, please? I'm used to having to be a bit careful with how memo
fields are treated, but I've never had any problems with ordinary text
fields before. FWIW, Lookup uses a connection object with global scope which
is already active on the page, but specifies its own recordset object to do
its work. Other tests show that Lookup is returning the intended results -
for example if the field has length > 0 it's returned from Lookup fine. It's
just the If ... Then that seems to be sulking when "" is returned for test.

Thanks  - Mike -



Fri, 01 Nov 2002 03:00:00 GMT  
 If..Then incorreclty sensing empty char string from Access
Sorry to waste your time & brainpower, guys. I hadn't taken steps to convert
any Nulls coming from the database into zero-length strings ( by "" &
objRS("resultfield").

Doh.                - Mike -

Quote:
>For some reason, when Lookup finds a record and this particular Access
field
>has a "" value,  the If..Then loop fails to trigger and DoSomething is
never
>done



Sat, 02 Nov 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. char after each 2 chars in a string.

2. GS: Changing image sense and bit sense.

3. Access to string chars

4. Inserting/Updating Access Database With Empty Strings

5. Problem: Access not accepting empty string in numeric field from VB.

6. Empty String (in Access) to NULL (in SQL) via VB

7. Empty string with ACCESS

8. I give up - Strings and quotes make no sense

9. Accessing empty/null Memo Fields in a Access 97

10. Differences between NULL, Empty String, Null String?

11. making sense of access form design

12. Does ADO Make sense for access

 

 
Powered by phpBB® Forum Software