Drop down list to launch macros

G

Guest

Hi,

i have a form and on it instead of buttons that trigger the built in wizard
macros (find record, print form) I want to create a drop down box which has a
list of options (save, print, find) that when you select one it triggers the
macro.
The data for the box will be a table.
The code for the macros will simply be taken from the ones the wizard
generate.
But how do i tie everything in. I've never programmed in Access, more of an
Excel man.

Any help will be most appreciated.
 
T

tina

are you wanting to run macros, or VBA code? unlike Word and Excel, in Access
they're two different animals.

hth
 
T

tina

hmm, okay. since you're going to take the code generated by the wizard for
each action (that's a good way to get started learning VBA in Access, btw),
the easiest thing would probably be to go ahead and generate all the "action
code" you need, then cut and paste the code into the combo box control's
AfterUpdate event procedure. something along the lines of

Select Case Me!ComboboxName
Case "Save"
<paste here the code for the save action>
Case "Print"
<paste here the code for the print action>
Case "Find"
<paste here the code for the find action>
End Select

replace ComboboxName with the actual name of your combo box control, of
course. the above code assumes that the combo box control's BoundColumn is a
text data type the holds the values "save", "print", and "find" (as well as
whatever other actions you want to add). also, if you're not sure how to
create an event procedure "on your own", go to
http://home.att.net/~california.db/instructions.html and click on the
CreateEventProcedure link for illustrated step-by-step instructions.

you'll want to read up on the Select Case statement in VBA Help so you
understand how it works. if you're not comfortable with combo box controls,
you'll want to read up on them as well, in Access Help, paying special
attention to the control's RowSource, ColumnCount, ColumnWidth, and
BoundColumn properties.

hth
 

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