|
-
Sep 28th, 2000, 04:00 PM
#1
Thread Starter
Lively Member
How can I read a NULL field from ACCESS into
a control in VB without getting Run Time
Error 94 (Invalid use of Null).
Example: Text1 = !Field1
When Field1 is 'empty' I get Run Time Error 94.
0101011001000010
01101111011011100110110001101001011011100110010101110010
-
Sep 28th, 2000, 04:08 PM
#2
Lively Member
If not isNull(!Field1) Then
Text1 = !Field1
End if
-
Sep 28th, 2000, 04:54 PM
#3
Thread Starter
Lively Member
Worked PERFECT. Thanks damonous!
0101011001000010
01101111011011100110110001101001011011100110010101110010
-
Sep 28th, 2000, 08:39 PM
#4
or you could try
text1 = "" & !Field1
I don't trust the IsNull function, have had problems with it before.
VBs handling of null values is absolutely rubbish. Null can in fact be a perfectly accepted value.
e.g.
An inventory product; if quantity = null it generally means the product has never been held in stock, whereas quantity = 0 means that it is held in stock but currently there are none on hand.
This really bugs me....specially when you have to convert from other databases that can handle it ok.
Thats my moan for today.
-
Sep 28th, 2000, 09:19 PM
#5
Member
I agree with Jethro.
I've written a function to check Null values as shown..
Private Function CheckNull(ByVal AValue as Variant) As Variant
if IsNull(AValue) Then
CheckNull = AValue
Else
CheckNull = ""
Endif
End Function
When I run my program it gives me some error message regarding NULL values... But the strange thing if i debug(F8) the program step by step NO ERRORS..
-
Sep 28th, 2000, 09:54 PM
#6
Hello All,
I use this little trick:
Code:
Text1 = !Field1 & ""
It works like a charm.
Best,
-
Sep 30th, 2000, 06:57 AM
#7
Thread Starter
Lively Member
Very smart trick Rogers!!!
0101011001000010
01101111011011100110110001101001011011100110010101110010
-
Sep 30th, 2000, 07:59 AM
#8
_______
<?>
'speaking of tricks..here's another rs = recordset
Text1 = Format(rs("yourfieldname"))
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|