Need help checking null values in text type fileds in Visual Basic 5
Hi
I am working on a project in Visual Basic 5 and SQL Server 7 as database where I need to insert and update data in text type fields.
The problem I am facing is that whenever I check for null values in text type fields I am getting an error trying to insert or update.
Is there a way to check for null values in text fields and bypass it if its true.
Any help would be highly appreciated.
Thanks in advance.
Need help checking null values in text type fileds in Visual Basic 5
Hi
Thanks for your reply but my problem is that using IsNull function, when I check the text fields, it returns null values even if the text field contains valid data.
Also when I am updating text fields in the database I am getting errors.
Is there a way around.
Thanks
Need help checking null values in text type fileds in Visual Basic 5
Hi
I get the error invalid use of null. Actually I have got the work around which is to use a temporary variable which I can then check for null instead of check directly the recordset field.
Anyways thanks guys to everybody who responded.
Bye
Re: Need help checking null values in text type fileds in Visual Basic 5
Quote:
Originally posted by Jeev
Hi
I get the error invalid use of null. Actually I have got the work around which is to use a temporary variable which I can then check for null instead of check directly the recordset field.
Anyways thanks guys to everybody who responded.
Bye
No need to use a variable.
To get values from a field in your RS object which may contain NULL use:
Code:
rs.Fields("Fld_x").Value & ""
if not, you will get the error invalid use of null
To check if the field is null
Code:
IsNull(rs.Fields("Fld_x").Value)
Also it's always best if you will post the code you're having problem with