How to handle empty fields in database....
Hi,
I'm using Recordset to retrieve data records from the database and place
them in a ListView.
The problem I'm facing now is that some of the fields in the recordset is
empty. When I tried to run my application, it just stop at the record which
has an empty field and returns "Invalid use of Null'.
I would like to know what I should do for the recordset to retrieve empty
fields from the database.
Thanks in advance
Angus Ching
Re: How to handle empty fields in database....
Hi
This is covered in the Open FAQ in the CodeGuru/vb site - to fix your problem, simply append an empty string (ie. "") to the assignment,
e.g.
Text1.Text = oRecordSet.Fields("TestField") & ""
That way, any null value is converted to an empty string.
Look at then Open FAQ for more help
http://www.codeguru.com/vb/openfaq/open_faq.shtml
Regards
Chris Eastwood
Re: How to handle empty fields in database....
Hello Angus,
the other way as that of Chris is that you check in your program, if a field is empty, with the function isnull.
if not isnull(Recordset!Field) then ... else ...
Greetings
Ting
Re: How to handle empty fields in database....
You could probably check with the ISnull Function when you are retriveing from the databse , branch off when it is Null