"MLH" wrote in message:
news:hb********************************@4ax.com...
Tell me if this assignment should return "Invalid use of Null" error:
Dim RememberedReportNum AS Long
RememberedReportNum = DLookup("[CredReptID]", "[tblCreditReports]")
While considering your response, here's what the DLookUp returns:
? DLookup("[CredReptID]", "[tblCreditReports]")
#NULL#
Can RememberedReportNum not receive the value of #NULL# ?
Only Variant data types can handle Null values.
Consider this example behind a command button for illustration:
Private Sub Command0_Click()
Dim RememberedReportNum As Long
RememberedReportNum = DLookup("[CredReptID]", "[tblCreditReports]")
If IsNull(RememberedReportNum) = True Then
MsgBox "It is Null"
Else
MsgBox RememberedReportNum
End If
End Sub
Pressing the button will yield Error 94, Invalid use of null.
Now change it to a Variant and see what happens:
Private Sub Command0_Click()
Dim RememberedReportNum As Variant
RememberedReportNum = DLookup("[CredReptID]", "[tblCreditReports]")
If IsNull(RememberedReportNum) = True Then
MsgBox "It is Null"
Else
MsgBox RememberedReportNum
End If
End Sub
This time the message box saying it is null appears.
--
Jeff Conrad
Access Junkie
Bend, Oregon
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----