Using listbox as a Variable

J

jpowell

Hello,

I have a form for adding/editing emails (frmEmails) which gets called
from many different forms. I would like to pass a listbox in as a
variable from each form, so that after adding/updating I can easily
requery the appropriate list box. I just can't get this to work!

This is what my code is doing right now:

___________________________________________________

Dim frmEmails As Form_frmEmails

DoCmd.OpenForm "frmEmails"
Set frmEmails = Forms!frmEmails

With frmEmails

Set .ListBox = [form name].lstEmails
(I've tried with and without the Set)

End With
___________________________________________________


frmEmails

Private m_lstListBox As ListBox
______

Public Property Let ListBox(lstValue As ListBox)

m_lstListBox = lstValue

End Property
_______

(The procedure for running queries that do the work...)_Click

m_lstListBox.requery (the purpose of all of this)
_____________________________________________________

Why doesn't this work? I get error # 91. Please help!

Joshua
 
Top