BBaron
asked on
DAO/ADO/Access97/Access2000 and NULLS!!!! (Information only)
Lo again,
another quick question conserning DAO and ADO connected to a MS Access 2000 DB
Using DAO and setting text boxes up with whatever data is in the fields from a recordset is fine.
Using ADO however causes an invalid use of null error when setting the exact same record to the text boxes.
Why is this?, does this mean that I need to check each record for the existence of nulls before setting the
text boxes?, which is what Im doing now (pain in the butt!)
quick thought : Ive also converted from Access97 to Access2000, Could this be the difference? and not DAO/ADO?
Cheers
Ben
another quick question conserning DAO and ADO connected to a MS Access 2000 DB
Using DAO and setting text boxes up with whatever data is in the fields from a recordset is fine.
Using ADO however causes an invalid use of null error when setting the exact same record to the text boxes.
Why is this?, does this mean that I need to check each record for the existence of nulls before setting the
text boxes?, which is what Im doing now (pain in the butt!)
quick thought : Ive also converted from Access97 to Access2000, Could this be the difference? and not DAO/ADO?
Cheers
Ben
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Also, if your field's Required property is set to True, then you could not insert a record, without passing a value to the particular field.
But to our experience, setting Required to False, and Allow Zero Length to True, is a flexible one.
You could use deighton's one to handle with Null values. Not only for text box, wherever you might need it.
Another option, I dont know if this is viable to you or not:
When saving the records, itself, you dont save records with Null values, pass an empty string, instead. And for the existing data in tables, you do an UPDATE statement, to replace all the NULLs with empty string.
Cheers.
But to our experience, setting Required to False, and Allow Zero Length to True, is a flexible one.
You could use deighton's one to handle with Null values. Not only for text box, wherever you might need it.
Another option, I dont know if this is viable to you or not:
When saving the records, itself, you dont save records with Null values, pass an empty string, instead. And for the existing data in tables, you do an UPDATE statement, to replace all the NULLs with empty string.
Cheers.
ASKER
Cheers buddy, thats easier than using if isnull all the time!!!
Whatever = Format(AnotherStringValue)
If AnotherStringValue is a Null, this will prevent the error.
Good Luck