Solved

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

Posted on 2001-06-22
4
168 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

710 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