check for null in listbox

I

iwasinnihon

I am having difficulty checking to see if a certain column in a listbox
is null. My code follows.

If IsNull(Me!List5.Column(3)) Then

I have also tried

If Me!List7.Column(3) = "" Then

Both do nothing. It just does what is in the else. How can I get it
to see that the column is null?
 
J

Jeff Boyce

How about if you first confirm what IS in .Column(3)?

For one approach, use a messagebox in your code to print out what it DOES
find.

(is there a chance that you mean "the 3rd column"? The .Column method is
zero-based, so .Column(3) means the 4th column.)

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
I

iwasinnihon

I am sure it is column 3. I am aware that it is 0 based. I did create
a messagebox and had it print out what was there. It printed nothing.
I used code like this.

str = "a" + Me!List5.Column(3) + "b"

It printed

ab
 
J

Jeff Boyce

Great! It sounds like you've already confirmed that portion.

Have you tried something like:

If Nz(Me!List5.Column(3),"")="" Then
'do this ...
Else
'do that ...
End If

and put a breakpoint on the "If..." statement, so you can step through the
code, inspecting the values as each line executes?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
I

iwasinnihon

With that code I get the following error message.

Too few parameters. Expecting 2.
 
J

Jeff Boyce

"too few parameters" implies that there's a query involved, with selection
criteria. If there isn't, there may be some subtle corruption.


Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Top