Solved

null value in Dataenvironment

Posted on 2001-08-09
3
316 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
[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
3 Comments
 
LVL 5

Accepted Solution

by:
rkot2000 earned 50 total points
ID: 6368965
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
ID: 6368969
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
ID: 6369535
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS Access Search and Replace Using VBA 6 106
VBA/SQL - Connect to SQL server and pull data 4 153
Adding to a VBA? 6 93
Userform to show a range in excel. 3 34
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

752 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