First I have experimented quite a bit with the control and have never had it
cause the current Access session to improperly terminate.
For your redraw issue, you can force a redaw of the control. I believe it
exposes a hWnd property.
Here is a previous post of mine on a similiar issue.
From: Stephen Lebans (NoEm...@please.com)
Subject: Re: Menu Navigation
Newsgroups: comp.databases.ms-access
View: Complete Thread (18 articles) | Original Format
Date: 2002-03-05 17:31:27 PST
This issue has come up many times in the past. What's happening is the
ListBox needs to be repainted but Access seems to have missed the
message. As you pointed out Marshall, resetting the RowSource prop
solves the issue.
There may be occasions, where because of performance considerations, you
do not want to have to reset the RowSource. In these cases we can force
the Access GUI to redraw the ListBox and clear the selection(s).
Here's a post of mine on this subject.
From: Stephen Lebans (NoEm...@please.com)
Subject: Re: How to clear data in a List box?
Newsgroups: microsoft.public.access.forms
View this article only
Date: 2001-09-16 20:43:12 PST
Hi Arvin,
just as a point of interest, I have had trouble with programmatically
clearing selections from a ListBox. It seems sometimes Access will not
redraw the ListBox unless the entire control's window needs to be
redrawn.
For the ListBoxRownumbers project on my site I had to force the
control's window to be redrawn.
http://www.lebans.com/listboxrownumbers.htm
' API Declarations for Sub to clear selections
Private Declare Function InvalidateRect Lib "user32" (ByVal hWnd&,
lpRect As RECTL, ByVal bErase&) As Long
Private Declare Function GetFocus Lib "user32" () As Long
Private Declare Function GetClientRect Lib "user32" (ByVal hWnd&, lpRect
As RECTL) As Long
Private Type RECTL
left As Long
top As Long
right As Long
bottom As Long
End Type
Private Const API_TRUE As Long = 1&
' This sub is required to eliminate a bug/feature
' in Access with ListBoxes that we programmatically select rows in.
' Access does not redraw the control unless we cover up the entire
' control. We fake this by invalidating the entire window.
' Unless you have cached the hWnd the control must have the focus for
this
' to work.
Public Sub ClearSelections(Optional hWnd As Long)
Dim rc As RECTL
' Were we passed a hWnd?
' If not then get current control's hWnd
If hWnd = 0 Then hWnd = GetFocus
Call GetClientRect(hWnd, rc)
Call InvalidateRect(hWnd, rc, API_TRUE)
End Sub
' Code End
--
HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"mikez" <mi*******@yahoo.comwrote in message
news:11*********************@h48g2000cwc.googlegro ups.com...
Anybody? Anyone have any further ideas or suggestions?
THanks!
mike