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

x
?
Solved

null value in Dataenvironment

Posted on 2001-08-09
3
Medium Priority
?
321 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 150 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

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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

705 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