Keeping track of which listbox has focus: Best approach question



Access 2007 working in compatibility mode with a 2003 database.

I have three list boxes on a tab page. I also have buttons that
operate based on which list box has focus. So my approach has been to
keep track of which list box has focus by having the following kind of
code in the On Got Focus function of each list box:

Private Sub lbx_suspendedIndefinitely_manageMyTasks_GotFocus()
If Not (IsNull(Me.lbx_suspendedIndefinitely_manageMyTasks)) Then
Set suspendedListBoxWithFocus =
Me.lbx_suspendedIndefinitely_manageMyTasks
End If
End Sub

in which suspendedListBoxWithFocus is global to the form module.

Ultimately the problem I am running in to is that
suspendedListBoxWithFocus has a value of Nothing, so the Set code line
never does anything. I tried putting

suspendedListBoxWithFocus = New ListBox
Set suspendedListBoxWithFocus = Null

in the form's On Open subroutine, but this is also not working.

I think my whole approach must be hopeless. Can anyone suggest a
better approach to finding out which list box had focus just before
the user selected a command button?

- Paul
Schrum
.



Relevant Pages