reports macro

  • Thread starter georgeg via AccessMonster.com
  • Start date
G

georgeg via AccessMonster.com

Using Access 97 (no choice). From database main switch, I go to main reports
switch, from there I have buttons that points to a macro named "Pump reports
macro", from the macro I can preview/prints reports, works fine. I've added
several categories of reports in their own switches (all report selections
did not fit in main reports switch). I have multiple buttons in main switch
that point to different multiple report switches, I can open them, display
all new report selections and return to main switch with no problem.

Once in a second report switch I am unable to get Access 97 to point and open
a new report in a diffrent reports macro (i.e. Electric reports macro). I
get errors that make reference to reports defined in the original "Pump
reports macro", is there a way to have multiple report switches point to a
specific reports macro? At this point I am unable to see the forest through
the trees, any ideas?

Much thanks for your help.

George
 
S

strive4peace

Hi George,

instead of using macros and the "Switchboard" to control
your application, consider this:

make your own menu form -- or modify the Switchboard you
already have --> change the Click event code for the buttons
that are already created.

If you use VBA instead of macros, you will have a lot more
flexibility to do what you want. It is easy to convert
macro actions to VBA

for instance, if you have a macro that uses
OpenForm

the VBA code would be

DoCmd.OpenForm "formname", etc if you have more parameters

You can convert any macro command to code using

DoCmd.macroaction

Once you type Docmd., auto-complete will prompt you with a
list of macro actions

after you pick the macro action, press the SPACEBAR to
(insert a space after the macro action name) and you will be
prompted for each parameter. Seperate parameters with commas.

Press TAB to insert a selected value from the auto-complete
list.

~~~~

here is VBA syntax for a couple common macro actions:

DoCmd.OpenReport reportname[, view][, filtername][,
wherecondition]

DoCmd.OpenForm formname[, view][, filtername][,
wherecondition][, datamode][, windowmode][, openargs]


anything in square brackets is [optional]

~~~~

to change a form, choose the design view

turn on the properties window if it is not showing
(from the menu --> View, Properties)

click a control you want to launch a program for

from the ALL or OTHER tab, look at the first property
listed, NAME, and change the name to somthing logical if it
is ambiguous. Don't use spaces or special characters
(except underscore _ ) in names.

choose the EVENT tab of the Properties window

click in the OnClick event

if there is something there from the switchboard, delete it

click on the Builder (...) button to the right

choose "Code Builder" if you are prompted

Access will construct a sub declaration and an end sub
statement -- type the code you want to execute between those
2 lines.


Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 

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