
How to make a Listbox requery
I suspect that the problem may be that the current record, though
modified by changing the value of the check box, hasn't yet been
saved. So if you currently have an AfterUpdate event procedure along
these lines:
Private Sub chkMyCheckBox_AfterUpdate()
Me.myListBox.Requery
End Sub
you need to add a line to force the current record to be saved before
requerying. It might then look like this:
Private Sub chkMyCheckBox_AfterUpdate()
Me.Dirty = False
Me.myListBox.Requery
End Sub
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
Quote:
> Hi ( Access 2000 running on Win2K )
> I can not get a listbox to requery due to changing the state of a
check box
> on the form.
> The scenerio
> A On the form there is a checkbox that sets a yes/no field in
the
> master table to yes or no
> B The listbox on the form has a query based on the same
master table
> that only displays records for which the field associated with the
checkbox
> are set true.
> C I created an event for the checkbox using the On Click
property.
> The requery property of the list box name is called, e.g.
> myListBox.requery
> The behaviour is that unless I exit the form and re-enter it, the
listbox
> will never show the records which have had the checkbox checked in
the
> session. Requerying the entire form is slow and it seems to me that
it
> should be unnecessary. Since the .requery doesn't do what I think
it should
> do, what is it really supposed to do then ??
> I can't find anything in the KB to suggest any other way to approach
this.
> Seems like I'm missing something here.
> Mark