Access of Listbox contents in OnOpen gines Null

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I load a listbox in the OnOpen event and also sometimes need to access its contents (its a Valuelist). I can load the listbox, but when I refer to Me!LB.Column(0), its a Null. It seems I can't refer to the contents until the form is displayed, since it works fine in the OnClick event. Any way around this?
 
You can usually read the values of controls in the on-open event, but you
CAN NOT modify values.

The on-open event of a form has a "cancel" feature, and if you set cancel =
true, then the form does not load.

So, on-open, is really for checking values, and things that *could* allow
you to change your mind if the form is to be opened (for, example, if the
record is locked by somene else..you could display a message..and the form
would NOT load).

So, once your checking/testing code to allow the form to open is completed,
then any code that sets up the forms values, defaults and initialize your
variables etc belongs in the forms on-load event..NOT the on open. On open
is too soon to start playing with, and modifying values..and further..the
on-open event is not for setup and initializing code anyway.

So...move your code stuff to on-load.....
 
Back
Top