Using list box to open forms

L

lecoughlin

I have a list box that lists all the forms in my database. I would
like a user to be able to double click on something in the list box,
and have it open the corresponding form. Any help on how to do this
would be appreciated.

Thanks.
 
F

fredg

I have a list box that lists all the forms in my database. I would
like a user to be able to double click on something in the list box,
and have it open the corresponding form. Any help on how to do this
would be appreciated.

Thanks.

Code the list box Double-Click event:

DoCmd.OpenForm Me![ListBoxName]
 
L

lecoughlin

Thanks

I have a list box that lists all the forms in my database. I would
like a user to be able to double click on something in the list box,
and have it open the corresponding form. Any help on how to do this
would be appreciated.

Code the list box Double-Click event:

DoCmd.OpenForm Me![ListBoxName]
 
F

fredg

What if I have a mix of forms and tables I'd like to be open from the
list box. What is the code to check what type of object it is?
Thanks

Thanks

On Wed, 24 Oct 2007 16:35:22 -0000, (e-mail address removed) wrote:
I have a list box that lists all the forms in my database. I would
like a user to be able to double click on something in the list box,
and have it open the corresponding form. Any help on how to do this
would be appreciated.

Code the list box Double-Click event:
DoCmd.OpenForm Me![ListBoxName]

Giving a user access to your tables is equivalent to leaving the bank
vault doors unlocked. Sooner or later your going to be missing
something.

However, if you must...

Simplest (for me) is to have one List box for forms and another for
tables.
Docmd.OpenTable Me![ListBoxName]
will open a table.

If you were to have both in one, just use error handling:

On Error GoTo Err_Handler
DoCmd.OpenForm Me![ListBoxName]

Exit_Sub:
Exit Sub
Err_Handler:
If Err = 2102 Then
DoCmd.OpenTable Me![ListBoxName]
Else
MsgBox "Error #: " & Err.Number & " " & Err.Description
End If
Resume Exit_Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top