Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

916 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