Listbox beforeupdate

  • Thread starter Thread starter Lars Brownies
  • Start date Start date
L

Lars Brownies

Hi,

When the user makes a selection in an unbound listbox I would like to check
the another field's value before the item of the listbox is selected. If the
check returns negative a msgbox should pop up, and the listbox should keep
its original selection. I checked the beforeupdate of the listbox but when
that fires the listbox selection has already been made. Can this be done?

Thanks in advance,

Lars
 
On Thu, 19 Mar 2009 05:39:39 +0100, "Lars Brownies"

Fortunately BeforeUpdate is a cancellable event, so you can write:
if not IsValid() then
Cancel = True
end if

private function IsValid() as Boolean
'perform your check here; return True or False
end function

-Tom.
Microsoft Access MVP
 
Cancel = True doesn't cancel the listbox selection if you click on the
listbox. It seems to get the selection before the beforeupdate fires.

Lars
 
Back
Top