Can I base the form opened by a command button on a combo box?

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

Guest

I have a Combo Box where users select the type of transmittal they want to
create. Each transmittal type has a unique Form with different fields to
fill. After the user selects the type of transmittal they want to create from
the Combo Box, they should be able to click a single command button which
will open only the form selected in the combo box. How do I base the form
opened by a command button on the selection made in a combo box?
 
Here's one relatively simple approach:
Create a table with two text fields, FormName and ComboText.
Make FormName the primary key.
For each form you want to have available, fill in the name of the form
and the text you want to have appear in the Combobox.
Create a Combobox using the wizard, based on your new table.
Name the combo cboForm. (You can choose another name, but if you do,
use that name wherever I put cboForm in the rest of these directions.)
When you view the form in Form View, you should see your ComboText
entries in the combobox's drop list.
Back in Design View, use the wizard to create a command button. Choose
a single form to have it open.
In the Visual Basic Editor window, find the code for this button.
Find the line which starts like this:
stDocName = ...
right after the = should be the name of the single form you chose in the
wizard, surrounded by double quotes.
Replace that text **including the quotes** with this:
cboForm

Return to Form View and see if the form operates as you wish.

HTH
 
Thank you very much for your reply. I understand your response & will try
this approach out. I already have a Transmittal Type Table, so part 1 is
complete.
 
Dear MacDermott:
This procedure worked like a charm. Thank you very much!!!
 

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

Back
Top