listbox empty until focus

  • Thread starter Thread starter Han
  • Start date Start date
H

Han

I have a form that contains a listbox. I have set the "On Enter" property to
fire a sub routine which populates the listbox. The problem is the listbox
is empty until selected (either by tabbing or mouse click.) I have tried
moving the event trigger to beforeupdate and afterupdate without success. I
also recreated the listbox a second time (just to be sure certain something
didn't get messed up.)

Does anyone know why the contents of my list won't appear until selected?

Thanks in advance,
Han
 
You have created a routine to populate the listbos in the On Enter event of
the list box. This event does not occur until you enter the list box - ie
move the cursor into the list box. So, of course the list box is not filled
until you select it. The only thing about this that is surprising is that
you find this behaviour surprising!

You need to move your procedure into one of the form's events - open or load
(if the list box contents do not vary according to which record is selected)
or current (if the list changes from record to record).
 
Ok, I probably deserved that. :-]

So, I moved the sub to the form's On Current event and all is well.

Here's the reason for my confusion. I had another form with the same exact
functionality (i.e. listbox tied to the On Enter event) and it worked
great--the list was magically filled with content. I understand now that the
reason for this was because the listbox was selected (focused) by default on
load.

Admittedly, I'm new to Access forms and quite frankly will do everything in
my power to avoid them once this project is complete. ;-)

In any event, I do appreciate the help and clarification.
 
| Admittedly, I'm new to Access forms and quite frankly will do everything
in
| my power to avoid them once this project is complete. ;-)
|

Hi Han,

Everyone starts from a newbie :- ) Please feel free to post your questions
in the newsgroup and we all newsgroup guys are ready to help you ^_^


Sincerely,

Alick Ye, MCSD
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.



--------------------
| From: "Han" <[email protected]>
| Newsgroups: microsoft.public.access.forms
|
| Ok, I probably deserved that. :-]
|
| So, I moved the sub to the form's On Current event and all is well.
|
| Here's the reason for my confusion. I had another form with the same exact
| functionality (i.e. listbox tied to the On Enter event) and it worked
| great--the list was magically filled with content. I understand now that
the
| reason for this was because the listbox was selected (focused) by default
on
| load.
|
| Admittedly, I'm new to Access forms and quite frankly will do everything
in
| my power to avoid them once this project is complete. ;-)
|
| In any event, I do appreciate the help and clarification.
|
| | > You have created a routine to populate the listbos in the On Enter event
| of
| > the list box. This event does not occur until you enter the list box -
ie
| > move the cursor into the list box. So, of course the list box is not
| filled
| > until you select it. The only thing about this that is surprising is
that
| > you find this behaviour surprising!
| >
| > You need to move your procedure into one of the form's events - open or
| load
| > (if the list box contents do not vary according to which record is
| selected)
| > or current (if the list changes from record to record).
| >
| > | > > I have a form that contains a listbox. I have set the "On Enter"
| property
| > to
| > > fire a sub routine which populates the listbox. The problem is the
| listbox
| > > is empty until selected (either by tabbing or mouse click.) I have
tried
| > > moving the event trigger to beforeupdate and afterupdate without
| success.
| > I
| > > also recreated the listbox a second time (just to be sure certain
| > something
| > > didn't get messed up.)
| > >
| > > Does anyone know why the contents of my list won't appear until
| selected?
| > >
| > > Thanks in advance,
| > > Han
| > >
| > >
| >
| >
|
|
|
 
Back
Top