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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Null Value Assignment 1

Status
Not open for further replies.

mans

Programmer
Mar 18, 2000
136
AU
Hello,

I am using Access2000 with VB6. I am attempting to assign a text value from the database to a text box eg Text1 = rs!Comments. I get an error message saying that I cannot assign a null value when there is no data. The database has the data type as text, it does not require a value and allows zero length.

I read a previous article in this forum concerning a similar problem although it was quite specific to date/time and number data types.

Can somebody please let me know what I need to do to allow the text boxes to accept null (text) values. I am really hoping to avoid having to undertake similar actions to the solutions described for the date/time problem above.

Thank You
 
The immediate if should work.

Text1 = iif(isnull(rs!Comments)," ",rs!Comments)
David Paulson


 
The typical shortcut to this is this:

Text1.Text = rs!Comments & ""

This will work if the value is Null and will not change the existing value, if there is one. There is no space between the two quotes. It's an empty string. Snaggs
tribesaddict@swbell.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top