multicolumn listbox auto select relevant records

scamas2008

New member
Local time
Yesterday, 18:34
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
 
Might be the Is Null. Try the IsNull() function instead.
 
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

Back
Top Bottom