Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: selecting a list box row by code


Message #1 by "Howard Stone" <ququmber@h...> on Fri, 29 Nov 2002 14:01:39
How can I programatically select and highlight a row in a list box where 
the multiselect property is set to None.

I have a list box named lstBox and if a cetrain condition is not met then 
using Cancel in the BeforeUpdate procedure of the listBox prevents 
update.  However, the list box is now highlighting the newly selected row 
even though the underlying value is still set to the previous row.

I would like to reset the selected row to the original. Using lstBox.Undo 
does not do it.

Thanks
Message #2 by "bwarehouse" <bwarehouse@y...> on Fri, 29 Nov 2002 08:21:50 -0700
try using something like.

dim odv
odv = lstBox.Oldvalue

If ..condition not met.. Then
   ...da da da 'your code
   odv.SetFocus
Else
   ...da da da
End IF
===============OR=========
If ..condition not met.. Then
   ...da da da 'your code
   lstBox = listBox.Oldvalue
Else
   ...da da da
End IF

later
bware


-----Original Message-----
From: Howard Stone [mailto:ququmber@h...]
Sent: Friday, November 29, 2002 2:02 PM
To: Access
Subject: [access] selecting a list box row by code


How can I programatically select and highlight a row in a list box where 
the multiselect property is set to None.

I have a list box named lstBox and if a cetrain condition is not met then 
using Cancel in the BeforeUpdate procedure of the listBox prevents 
update.  However, the list box is now highlighting the newly selected row 
even though the underlying value is still set to the previous row.

I would like to reset the selected row to the original. Using lstBox.Undo 
does not do it.

Thanks


  Return to Index