Re: Perform Check on Data
- From: Marshall Barton <marshbarton@xxxxxxxxxx>
- Date: Thu, 16 Nov 2006 17:32:04 -0600
mattc66 via AccessMonster.com wrote:
I have an Order Form that I want to perform a check on the data when the user
selects a Check Box.
I had the following in the onClick Event of the check box. This doesn't work.
It blows by them and displays an empty message box.
Dim MyStr1 As String
Dim MyStr2 As String
If Me.fldName1.Value = Null Then
MyStr1 = "txtName1 is Empty"
End If
If Me.fldName2.Value = Null Then
MyStr2 = "txtName2 is Empty"
End If
'Message box warning that data is missing.
MsgBox "The following Feilds are blank." _
& vbCr & vbCr & MyStr1 & "" _
& vbCr & vbCr & MyStr4 & "", vbOK, "Missing Data"
You can not compare anythig to Null, not even another Null.
Think of Null as meaning Unknown and then analyze the
comparison X = Null. I.e. Is X the same as an Unknown
value? The answer is always Unknown.
In VBA, use the IsNull function:
If IsNull(Me.fldName1.Value) Then
In SQL (or a query criteria) and in control source
expressions, use this instead:
fldname Is Null
The IsNull function will work in Jet SQL and in control
source expressions, but it is not as efficient in these
contexts.
--
Marsh
MVP [MS Access]
.
- Follow-Ups:
- Re: Perform Check on Data
- From: mattc66 via AccessMonster.com
- Re: Perform Check on Data
- References:
- Perform Check on Data
- From: mattc66 via AccessMonster.com
- Perform Check on Data
- Prev by Date: Issue with adding a new record to a bound subform
- Next by Date: Re: Passing multiple parameters to Stored Procedure
- Previous by thread: Perform Check on Data
- Next by thread: Re: Perform Check on Data
- Index(es):
Relevant Pages
|