multicolumn listbox auto select relevant records (1 Viewer)

scamas2008

New member
Local time
Today, 08:36
Joined
Jun 14, 2019
Messages
1
Hello all, I am fairly new to access, and if it weren't for forums like these, I would have given up on this a long time ago, so thank you in advance!
Here is the situation:
I need to filter a multicolumn list box to show "active" certificates on the date I enter in a textbox in the form. I have tried to use a query for the listbox and a select all event on GotFocus but it does not update to current record, even when using requery. So I am now trying to automatically select relevant records. This is my code, but it does not like my If.... line.
Any suggestions?


Private Sub ApplytoShares_GotFocus()
Dim lngRow As Long

With Me.ApplytoShares
For lngRow = 0 To ApplytoShares.ListCount - 1
If (Me.ApplytoShares.Column(1, lngRow)) < Me.DivPdDate And (Me.ApplytoShares.Column(2, lngRow)) Is Null Or (Me.ApplytoShares.Column(2, lngRow)) < Me.DivPdDate Then

ApplytoShares.Selected(lngRow) = True
End If
Next lngRow

End With

End Sub
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 07:36
Joined
Aug 30, 2003
Messages
36,118
Might be the Is Null. Try the IsNull() function instead.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:36
Joined
Oct 29, 2018
Messages
21,358
Hi. Welcome to the forum. If IsNull() doesn't work, you could also try ="". If that still doesn't work, we'll probably need to see your setup.
 

Users who are viewing this thread

Top Bottom