Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2001-06-22
4
Medium Priority
?
172 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 150 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

704 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