|
-
Dec 5th, 2000, 08:39 PM
#1
Thread Starter
Member
When I run the following code:
With rsPI
txtFSN.Text = !FSN
txtFirst.Text = !First_Name
txtLast.Text = !Last_Name
medSSN.Text = !Soc_Sec
txtMI.Text = !MI_Name
...
I get "Run time error '94': Invalid use of Null" with the
debug pointing to the "txtFSN.Text = !FSN" line. If I comment that out and rerun it, I get the same error on the "txtMI.Text = !MI_Name" line. With that line (and the following assignment lines) commented out, the form displays OK.
Can someone explain the concept of "Null" as used in this error message? And what I need to do to correct the problem?
-
Dec 5th, 2000, 08:56 PM
#2
_______
<?>
Your database field has a null value
change
I think this will work
txtFsn.datafield = format(rs("Field"))
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Dec 5th, 2000, 09:03 PM
#3
PowerPoster
You need to check for the return from your recordset is a NULL string before you assign it to the textbox control
You can do it both way... But the IIF will be a bit slow, because it check both True and False condition before it make the decission
Code:
With rsPI
txtFSN.Text = IIf(IsNull(!FSN), "", !FSN)
txtFirst.Text = IIf(IsNull(!First_Name), "", !First_Name)
txtLast.Text = IIf(IsNull(!Last_Name), "", !Last_Name)
medSSN.Text = IIf(IsNull(!Soc_Sec), "", !Soc_Sec)
txtMI.Text = IIf(IsNull(!MI_Name), "", !MI_Name)
End With
OR
Code:
With rsPI
If IsNull(!FSN) Then
txtFSN.Text = ""
Else
txtFSN.Text = !FSN
End If
If IsNull(!First_Name) Then
txtFirst.Text = ""
Else
txtFirst.Text = !First_Name
End If
If IsNull(!Last_Name) Then
txtLast.Text = ""
Else
txtLast.Text = !Last_Name
End If
If IsNull(!Soc_Sec) Then
txtmedSSN.Text = ""
Else
txtmedSSN.Text = !Soc_Sec
End If
If IsNull(!MI_Name) Then
txtMI.Text = ""
Else
txtMI.Text = !MI_Name
End If
End With
-
Dec 6th, 2000, 03:38 AM
#4
Fanatic Member
Try this
Code:
With rsPI
txtFSN.Text = "" & !FSN
txtFirst.Text = "" & !First_Name
txtLast.Text = "" & !Last_Name
medSSN.Text = "" & !Soc_Sec
txtMI.Text = "" & !MI_Name
End With
VB6 sp5, SQL Server 2000, C#
There are no stupid questions. Only stupid people. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|