I'm trying to test a 4 field, 1 row table, on form_open, to determine if
any one of the fields are empty or not.
But using this example, my If (Null or "")test is ignored:
Dim db As Database, RS As Recordset
Set db = DBEngine.Workspaces(0).Databases(0)
Set RS = db.OpenRecordset("SELECT * FROM tblSerial")
If RS.BOF And RS.EOF Then
'Do Error indication here
End If
Me!Testbox = RS![BaudRate] 'This does display value or blank
If RS![BaudRate]= Null Then 'Never happens regardless of value
MsgBox "Baud Rate empty",,"Missing data"
End If
Is there a quick way to test to see if any field is empty? Or just If
test each, one by one?
Any suggestions appreciated
Alex Dybenko - 08 May 2007 06:34 GMT
Hi,
try:
If isnull(RS![BaudRate]) Then

Signature
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
> I'm trying to test a 4 field, 1 row table, on form_open, to determine if
> any one of the fields are empty or not.
[quoted text clipped - 16 lines]
>
> Any suggestions appreciated
John Spencer - 08 May 2007 12:24 GMT
Or another alternative to test for both null and zero-length strings
If Len(RS!BaudRate & vbNullString) = 0 Then
or even more paranoid - null, zero-length strings, strings that are all
spaces
If Len(Trim(RS!BaudRate & VbNullString)) = 0 Then

Signature
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
.
> Hi,
> try:
[quoted text clipped - 20 lines]
>>
>> Any suggestions appreciated
Stewart - 08 May 2007 13:28 GMT
That solved it.
Thanks
---
> Or another alternative to test for both null and zero-length strings
>
[quoted text clipped - 4 lines]
>
> If Len(Trim(RS!BaudRate & VbNullString)) = 0 Then