ms-access


Highlight rows in listbox from values in recordset


On my forms Load event I'm loading a list of clients from sql table. On my Current even I'm trying to loop the listbox and highlight rows from my recordset.
I have this but it's not working. what am I missing?
For i = 0 To Me.ClientList.ListCount - 1
If Me.ClientList.Column(0, i) = rs.Fields(0) Then
Me.ClientList.Selected(i) = True
rs.MoveNext
End If
Next
What I found out was that the Me.ClientList.ItemData was text value and rs.Fields(0) was int. So use CInt to convert and it will evaluate correctly. Hope this helps.
If CInt(Me.ClientList.ItemData(i)) = rs.Fields(0) Then
Me.ClientList.Selected(i) = True
rs.MoveNext
End If

Related Links

Wildcards in an Access IIF statement
How do I select a specific column based on a variable in a MS Access query?
MS access columns to rows
Windows 7 VirtualStore with Access 2010 and FtpGetFile
Maximum Field Reached for Access 2007
indexing without duplicate and that imapct on speed of data retrieval
Issue using Access DoCmd.Rename on table: linked names not renamed
accde ran using runtime stops any code from executing
How can I use the database commands 'Seek' and results 'NoMatch'?
Adding multiple records to a table using radio buttons and check boxes, Access 2003
Get caption of closed report
Query access db using silverlight in an oob app with full trust?
runing a query of combinationfield in runtime,how?
Vim macro with ^M doesn't work
Infinitely looping through a recordset in VBA
Issue with the TOP 1 query

Categories

HOME
pycharm
reserved
google-api-php-client
office365api
electron
tesseract
jsp-tags
google-oauth
infragistics
ip
umd
add
modelica
clojurescript
graphlab
angular-ui
swiftlint
mps
accessor
dcevm
claims-based-identity
angular2-aot
qhull
su
strncpy
bpel
librato
unboundid
skia
socialengine
galsim
google-sites-2016
usbserial
ios5
bitbucket-pipelines
retina-display
x11-forwarding
objectlistview
reportbuilder
mesos-chronos
android-tabhost
fedex
janrain
android-mediaprojection
qwt
angular-resource
rainbowtable
strptime
integrity
recursive-datastructures
carrot
tactic
android-cursor
media-player
mako
gcsfuse
orthogonal
minimization
chord-diagram
objective-c-swift-bridge
log4c
qpid
markojs
lua-5.1
hill-climbing
livequery
t4mvc
mutation-observers
dukescript
deis
myo
operator-precedence
tt-news
asp.net-dynamic-data
javafx-webengine
castle
system.net.webexception
concurrent-collections
cloud-connect
centos5
mcts
farseer
listings
specification-pattern
tinn-r
typoscript2
simba
libstdc++
errai
onsubmit
enter
netbeans-6.9
qt-jambi
mod-auth
coredump
yetanotherforum
locate
jmock
lang
blitz++
revisions
getresponsestream
simpletest
procedural-music
putchar

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App