Create Drop Down Menu to open form?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good Day...

I know there should be a way to create a drop down menu to open a form /
forms? How would I do this?

Any suggestions?

Brook
 
Good Day...

I know there should be a way to create a drop down menu to open a form /
forms? How would I do this?

Any suggestions?

Brook

What do you have in mind? Having the combo box ("drop down"'s proper
name) give a list of form names, or data to determine which record
should be shown on the form, or what?

John W. Vinson[MVP]
 
I know there should be a way to create a drop down menu to open a form /

do you mean, to choose which of several forms to open? assuming you want to
use this "drop down menu" (called a combo box control) on a form - perhaps a
menu form or switchboard form - you can add an unbound combo box control to
the form and set its' properties as follows:

RowSourceType: Value List
RowSource: FormNameForUserToSee; NameOfFormObjectInDatabaseWindow;
NextFormNameForUserToSee; NameOfFormObjectInDatabaseWindow
(continue the above listing until you've listed all the forms you want the
user to choose from, using the syntax as shown)
ColumnCount: 2
ColumnWidths: 2"; 0"
LimitToList: Yes

so the first column in the combo box will be the form names that you want
the user to see. the second column will be the actual name of each form as
it is listed in the database window - and the user will *not* see that
column in the droplist.

in the combo box AfterUpdate event procedure, add the following code, as

DoCmd.OpenForm ComboBoxControlName.Column(1)

columns in combo box controls are zero-based, so "Column(1)" refers to the
second column in the combo box. if you need to further control how the form
opens, see the OpenForm Action topic in Help. if you don't know how to add
an event procedure in a form, see "Create a VBA event procedure" at
http://home.att.net/~california.db/downloads.html for illustrated
instructions.

hth
 
Well... two things...

I would like to have one list box that would drop down a list of forms
then the user would choose a form to open and another list box to drop down
and let the user choose a report to open.

Thanks for the fast response...

Brook
 
Tina...

I'm sorry... but i'm a little confused... this sounds like what I want to
do but am unsure how to do it via your instructions...

this portion is what i'm unsure about:

RowSource: FormNameForUserToSee; NameOfFormObjectInDatabaseWindow;
NextFormNameForUserToSee; NameOfFormObjectInDatabaseWindow
(continue the above listing until you've listed all the forms you want the
user to choose from, using the syntax as shown)

what do you mean by NameofFormObjectinDatabaseWindow? and do I sepearate all
by the " ; " symbol?

Brook
 
comments inline.

Brook said:
Tina...

I'm sorry... but i'm a little confused... this sounds like what I want to
do but am unsure how to do it via your instructions...

this portion is what i'm unsure about:

RowSource: FormNameForUserToSee; NameOfFormObjectInDatabaseWindow;
NextFormNameForUserToSee; NameOfFormObjectInDatabaseWindow
(continue the above listing until you've listed all the forms you want the
user to choose from, using the syntax as shown)

what do you mean by NameofFormObjectinDatabaseWindow?

when you create a form, you name it something. when you close the form and
look at the database window, you see all the forms you've created, each with
the name you gave it, such as frmCustomers, frmProducts, frmMainMenu,
frmOrders, frmSwitchboard - whatever names you give your forms. these
"example" names are representative of names that i would give to my forms,
with the naming convention i use in my database. but i wouldn't want to show
those names to my user. so my RowSource might look like:
Customer List; frmCustomers; Products List; frmProducts; Main Menu;
frmMainMenu; Customer Orders; frmOrders; Switchboard; frmSwitchboard
and do I sepearate all
by the " ; " symbol?

yes. each semicolon serves to break the text of the RowSource property into
columns. since you've set the ColumnCount to 2, the RowSource text will be
read as "this goes in column 1"; "this goes in column 2"; "this goes in
column 1"; "this goes in column 2"...etc, etc, etc. (note that i used the
quotes for clarity; you don't need them when you type the text in the
RowSource property.)

hth
 
ok... so I have an understand up to this point... have my naming convention
set up in my cbo box, but when I select the form I want the drop down to go
to it doesn't open that form

What is the next step? i'm sorry for the problems...

BRook
 
I would like to have one list box that would drop down a list of forms
then the user would choose a form to open and another list box to drop down
and let the user choose a report to open.

One alternative (though I really don't like it all that much) is to
use the Switchboard Wizard in Access. It creates a form with buttons,
each of which can be programmed (using the wizard, you don't need to
write code) to launch forms or reports.

Alternatively, as Tina suggests, you can create your own Form. What
I've done is to create a table named Switchboard, with four fields -
Seq, ObjectType, ObjectName and ObjectLabel. ObjectName contains the
actual name of the Form or Report; ObjectLabel a human-meaningful name
for that report. For instance you might have a Report named
rptAnnualSummary with its ObjectLabel set to "Annual Summary Report".
Seq is just a number defining the order in which you want the
forms/reports to appear, and ObjectType is a number indicating whether
the object is a Form or Report (or, in my case, a query or a
procedure).

You would fill this table with the names and labels of your forms and
reports; then create an unbound Form. Use the New Form button on the
forms window but DON'T choose a table. Instead, put a Listbox (or two
if you prefer) on the form; its Row Source should be this switchboard
table.

You would then put VBA code in the listbox's DoubleClick event to
actually launch the form. Post back if you'ld like sample code.

John W. Vinson[MVP]
 
you're welcome :)
btw, Brook, suggest you also take a look at MVP John Vinson's "table"
solution elsewhere in this post. you may find that you like it better than
the combo box option.
 
Back
Top