Solved

null value in Dataenvironment

Posted on 2001-08-09
3
312 Views
Last Modified: 2010-08-05
Hi,
if i have null value in query in Dataenvironment and SQL statement, the field value equaled null gives me error when i want it to be displayed in Textbox.
for example:
Text1 = Dataenvironment1.rscommand1!fieldname
this give error # 94 (invalid use of nll)
please i need the code to avoid this problem

Thank You
0
Comment
Question by:asamir00
3 Comments
 
LVL 5

Accepted Solution

by:
rkot2000 earned 50 total points
Comment Utility
Text1 = Dataenvironment1.rscommand1!fieldname & "" or

if isnull(Dataenvironment1.rscommand1!fieldname)=false then
Text1 = Dataenvironment1.rscommand1!fieldname
end if

0
 
LVL 43

Expert Comment

by:TimCottee
Comment Utility
Try Text1.Text = "" & DataEnvironment1.rscommand1!FieldName

Or trap the null first:

If IsNull(DataEnvironment1.rscommand1!FieldName) Then
  Text1.Text = "Null Value"
Else
  Text1.Text = DataEnvironment1.rscommand1!FieldName
End If
0
 

Expert Comment

by:jnhgustin
Comment Utility
There was a very good article in this months VB Mag that suggests the following:

Try changing your query to handle preprocess the Nulls for you:
"Select CustomerID, IsNull(EmailAddress, 'na') as EmailAddress from Customers"

In other words, if EmailAddress is NULL, then substitute na instead of the Null.

Cool stuff. Hope it helps.

-- Josh
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
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…
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…
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now