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

MS Access Form Insertion Hidden value
Open an external file with a button on a form in Access 2007
Find function in Form Code Module
Docmd.Runsql Updating Select Max records by group
MS Access Can't Link to Encrypted Backend Database
Why is my LEFT JOIN an invalid operation (MS ACCESS 2003)
IIS7.5 MS Access Authentication
Getting a “Variable Not Defined” error when attempting to open a table in Access 2010
MS Access Report “per detail” formatting and accessing in VBA
Open form in access using criteria?
Temporarily change printer page size then revert back in Access 2007 using VBS
How to combine more than 2 Microsoft Access tables into one table?
Access mdb not giving correct result
MS Access Macro to change form to No data entry
setting control source property of a textbox of subform in its parent form in ms access?
I need to dynamically (and quickly) import part of the data in an Access table (a large one) into Excel

Categories

HOME
pandas
date
vbscript
blogger
image-processing
fft
dot
react-router
sqlite-net-extensions
webpack-2
baqend
ebean
windows-server
enterprise-library-5
mouse
bs4
slick-slider
primary-key
maude-system
vault
here-api
rascal
google-cloud-ml
circular-dependency
size
visual-studio-cordova
clearcase-ucm
transformation
solaris-10
nhibernate-envers
viewport
conemu
amazonsellercentral
tibco-mdm
restful-authentication
xpages-ssjs
buildbot
django-storage
bootstrap-duallistbox
nhapi
kendo-datasource
bpel
librato
skia
yadcf
gtrendsr
vsts-build-task
android-nestedscrollview
revolution-slider
libvpx
hilbert-curve
webix-treetable
jna
broadcastreceiver
ncalc
http-live-streaming
vao
wptoolkit
network-flow
react-scripts
hendrix
celery-task
tactic
akka-cluster
root-framework
abcpdf9
vmware-tools
login-control
whois
php-parse-error
spim
execute
apache-commons-fileupload
generic-programming
unity3d-gui
streambase
e10s
tt-news
dealloc
android-2.2-froyo
page-layout
android-hardware
browser-detection
gwt-ext
stage
joyent
horizontal-accordion
locate
sudzc
nsviewanimation
rescale
procedural-music
wsdl.exe
misv
ntvdm.exe

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