Listbox beforeupdate

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
 
T

Tom van Stiphout

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
 
L

Lars Brownies

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top