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 crashing using linked tables
How to remove spaces from field names when importing external data into MS Access 2010
Run-time error '-2147221233(8004010f)': object not found - Access Database
Access: converting form result to table
One to many Combo Box
Search & Replace Null with Value from Select Query (Enter Parameter Value)
Access - Append query won't append a string input in a texbox form
How to structure a database to take input and assign applicable questions appropriately
MS Acces - Modify data in Form and save record
Carry forward counter in Access
Intermittent ODBC Connection Error in MS Access connecting to ZORTEC with ZODBC
Could not open table in Visual Basic 6.0, generated in PowerDesigner 6 AppModeler
Access validation rule violation update query across multiple tables
MS Access Table transformation
Runtime error in vb6:operation not allowed when object is closed
MS Access Row Source on table on the Front End disappears

Categories

HOME
sendgrid
twitter
activiti
tinymce
relative-path
iterator
lodash
objectgears
survey
webpack-2
ckeditor
fingerprint
acquia
flyway4
constraint-programming
gitpitch
spring-xd
rascal
u-sql
qt-creator
jplayer
static-libraries
transformation
reverse-proxy
zapier
ml
scriptcs
kudan
bootstrap-tour
pepper
uninstall
c++-amp
srcset
sql-server-2012-express
bluestacks
exuberant-ctags
airconsole
wallpaper
sequential
wpf-controls
wixsharp
xcode-extension
swift3.0.2
sqlite2
document.write
broadcastreceiver
texmaker
heightmap
hibernate-tools
chain-builder
tizen-native-app
snmptrapd
sonarlint-vs
quartz-composer
migradoc
static-ip-address
spring-android
vmware-tools
slicknav
trash
contact-list
websitepanel
rgeo
angular-leaflet-directive
embedded-code
0xdbe
cakephp-3.1
nsight
oberon
npapi
jsonpickle
applescript-objc
google-reader
htmlcleaner
braille
balanced-payments
floating-point-precision
aqtime
ftps
shellexecute
mylyn
google-email-migration
propertyeditor
ticoredatasync
enter
transactionscope
window-management
nsobject
psi
actionview
propagation
infrastructure
filtered-index
yagni
aquaticprime
w3wp
msdev

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App