Click to See Complete Forum and Search --> : How to handle empty fields in database....


Angus Ching
February 23rd, 1999, 04:45 AM
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

Chris Eastwood
February 23rd, 1999, 05:18 AM
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

Ting Chen
February 23rd, 1999, 06:51 AM
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

April 21st, 2000, 11:41 AM
You could probably check with the ISnull Function when you are retriveing from the databse , branch off when it is Null