leenapedenekar
asked on
null value
I have a application in visual basic with access as backend
In the form if I take value for any text box and save it in the database
And next time while editing if I try to make it null and save it
Next time I get the error invalid use of null although I have checked for no values required
In the access and default value to “”
In the form if I take value for any text box and save it in the database
And next time while editing if I try to make it null and save it
Next time I get the error invalid use of null although I have checked for no values required
In the access and default value to “”
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
also can try like below, if you want to retrieve values from your db to textbox:
text1.text = "" & Rs("myfield")
this will make you ease and no need to check whether the value return is null or not.
text1.text = "" & Rs("myfield")
this will make you ease and no need to check whether the value return is null or not.
Yes, Colloseo, you are right. A senior moment. I'm afraid.
leenapedenekar
ryancys solution is probably the neatest for any text field.
Anytime you receive some text from the database that could possibly be null, just add & "" on the end of the line.
e.g. Text1.Text = Rs("myfield").Value & ""
For date and numeric fields that can possibly be null just use the IsNull function
If IsNull(Rs("myfield").Value ) Then
...
Else
...
End IF
JR
ryancys solution is probably the neatest for any text field.
Anytime you receive some text from the database that could possibly be null, just add & "" on the end of the line.
e.g. Text1.Text = Rs("myfield").Value & ""
For date and numeric fields that can possibly be null just use the IsNull function
If IsNull(Rs("myfield").Value
...
Else
...
End IF
JR
You'll need to test for null before you use it.
If Not MyVariable Is Null Then
...
End If