Solved

null value in Dataenvironment

Posted on 2001-08-09
3
314 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
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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to add contact name to VBA code to automate emails in outlook using a Template 11 81
VBA error replacing data 6 40
vb6 connector to mongodb 2 84
Spell Check in VB6 13 112
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

773 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