Opening forms

jmeek

Registered User.
Local time
Today, 03:48
Joined
Aug 16, 2005
Messages
38
Instead of using command buttons to open forms
I would like to open forms displayed in a list box
Is there a way of doing this, so for example the
listbox will show
CustomerForm
SupplierForm
OrdersForm
ProductsForm
When any of the above is clicked the relative
form will open.

Regards
jmeek
 
No Help

Thanks but the thread doesn't tell me how to open
the form from a list box so its of no help
 
Put this in the onclick event of your listbox:
DoCmd.Openform me.lstbox

This assumes that you are storing the name of the form in the bound column of the listbox.
 
Form Open

Hi ejstefl

Thats exactly what I needed and it was so
succint.
Thank you very much
 
change record source

How to dynamically change record source of
a form using the OnLoad event when the call
is from a listbox as follows

Private Sub List0_DblClick(Cancel As Integer)
DoCmd.OpenForm Me.List0
End Sub

Thanks
 
In the OnOpen event of the form, you would use the following command:

me.RecordSource = "qryMyRecord"

You can substitue "qryMyRecord" for any SQL statement.
 
change record source

ejstefl

I would like to put that statement somewhere
in the code you supplied below

Private Sub List0_DblClick(Cancel As Integer)
DoCmd.OpenForm Me.List0
End Sub

So when I open the form from a listbox it will pass
the parameter to the OnLoad event the form.

Thanks
 
Pass Parameters

If you recall I have a list of forms (8) displayed in a
listbox which will have loaded up 8 different queries
in those 8 different forms. Now since all the forms
and routines inside the forms are identical I thought
it would be better to use just the one form but have
the record source change depending on the items
shown in the list box and what is selected. This way
I could dispense with all those forms.
 

Users who are viewing this thread

Back
Top Bottom