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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 323
  • Last Modified:

null value in Dataenvironment

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
asamir00
Asked:
asamir00
1 Solution
 
rkot2000Commented:
Text1 = Dataenvironment1.rscommand1!fieldname & "" or

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

0
 
TimCotteeCommented:
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
 
jnhgustinCommented:
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now