Solved

DAO/ADO/Access97/Access2000 and NULLS!!!! (Information only)

Posted on 2001-06-22
4
167 Views
Last Modified: 2010-05-02
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
0
Comment
Question by:BBaron
4 Comments
 
LVL 18

Accepted Solution

by:
deighton earned 50 total points
ID: 6217497
if setting a database field then if the field property is 'allow zero length field = false then you can not put "" in it, you must put in at least one character.

If returning a field to a string then do

text1.text = rsRecordset("field") & ""  'as a fix to avoid nulls
0
 
LVL 2

Expert Comment

by:idorey
ID: 6217821
You can also use the format command to avoid this problem:

Whatever = Format(AnotherStringValue)

If AnotherStringValue is a Null, this will prevent the error.

Good Luck
0
 
LVL 9

Expert Comment

by:Valliappan AN
ID: 6217830
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.
0
 

Author Comment

by:BBaron
ID: 6217846
Cheers buddy, thats easier than using if isnull all the time!!!
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question