"runtime error '94', invalid use of null" error

hi all,

I have an app that uses ADO to connect to an Access database and let me access the the tables within. I have written an EDIT form which lets the user bring up all the values for a record in the recordset, the user can then edit these values and save them. Some of the entries in the recordset are blank and these seem to be giving me problems when i try to copy them into the text boxes on my form, I keep getting the error "runtime error '94', invalid use of null" error. I think the problem is that text boxes hold values as strings and string variables cannot hold NULL values. I am very new to VB and am not sure how to get around it, has anyone got any ideas

Below is an example of the code I use for giving the text boxes their values from the database:

txtAddress3.Text = frmCustomers.AdodcCustomers.Recordset.Fields("AddressLine3")

Any help would be greatly appreciated.

Thanks in advance,

John


Answer this question

"runtime error '94', invalid use of null" error

  • Camerons

    try this:

    txtAddress3.Text = frmCustomers.AdodcCustomers.Recordset.Fields("AddressLine3") & ""

  • gftdnhkask

    Hi,

    In addition to that. You can also check if the field has a null value:

    txtAddress3.Text = iif(IsNull(frmCustomers.AdodcCustomers.Recordset.Fields("AddressLine3")), "<specify default value if field is null>", frmCustomers.AdodcCustomers.Recordset.Fields("AddressLine3"))

    BTW, future questions regarding VB6 should be posted in  Microsoft Newsgroups.

     

    cheers,

    Paul June A. Domag



  • "runtime error '94', invalid use of null" error