can you use a combo box to change forms?

  • Thread starter Thread starter Antonio
  • Start date Start date
A

Antonio

Can you use a combo box to change forms? the look of the
form when using command buttons looks very out of date, so
i was hoping to use something else.
 
Antonio,

You certainly can. A flexible approach to this is to build a
table to list your forms so that the combobox has something
to draw the form info from and so you can easily add and
delete forms as needed. This table would have two fields...
FormName and Form with Form being the primary key. FormName
would hold the true name of the form (frmOrders) and Form
would hold a user friendly name (Order Form).

Setup your combo box to get it's info from the table with
the following RowSource...

SELECT FormName, Form FROM tblForms ORDER BY Form

Set the bound column to '1', column count to 2 and column
widths to 0";1.5". Now in the AfterUpdate you can use
something akin to the following.

Dim strForm as String

strForm = Me!YourComboBoxName
DoCmd.OpenForm strForm

Obviously, if you need to open it to a certain record, you
will need to code a WHERE clause to go with it.

Gary Miller
Sisters, OR
 
Can you use a combo box to change forms? the look of the
form when using command buttons looks very out of date, so
i was hoping to use something else.

Sure. Just base the Combo Box on a Query listing the names of the
forms; you might want to have a table with two fields - the actual
stored name of the form, e.g. frmClientEntry, and a "user friendly"
name "Client Entry and Editing". Make this the visible field of the
combo and the actual form name the bound column.

In the AfterUpdate event of the combo use code like

Private Sub cboChooseForm_AfterUpdate()
Dim strDocument As String
strDocument = Me!cboChooseForm
DoCmd.OpenForm strDocument, <optional arguments>
End Sub
 
Hey that's great...! I was looking for ideas to spruce up my forms,
and a navigation function like this would be excellent!!!! I just
tried it on one of my forms I'm working on and it worked without any
problem!

Kevin
 
Back
Top