Which is better: running macros or using code for this task?

  • Thread starter Thread starter hdharrison
  • Start date Start date
H

hdharrison

I have a task that I want to be able to click on a Button and it would mark
all "passed" options. (I didnt want to click each one as there are about 75
options.)

It looks like this: (fictionious database)


(Engine) (I have 6 other tab folders for different things)

Transmission Fluid Check
O Passed
O Failed

Oil Fluid Check
O Passed
O Failed

Power steering Fluid Check.
O Passed
O Failed

and so on.


I have tried to use a macro for a button but it does not invoke the macro.
So, My question is do I need to write code for the button so that it will
run the macro? Or create code from scratch for this? I would need to create
buttons for the other 6 tab folders also, so I am trying to make it simple.

This is what my macro looks for the most part.
(Macro is PassedOptions)
SetValue Transmission Fluid Check
SetValue Oil Fluid Check
SetValue Power steering Fluid Check


That is all of the info I have regarding this macro. I suspect that the
macro is not set up right as I beleive that we would need to put "=1" after
the setvalue, but I could be wrong.

Any suggestions?

Dustin
 
It is not clear to me what the letter "O" in front of the Passed is, nor do
I know what you want to mark after indicating something has passed.

If it is a pass fail option I would set the fields (E.G.
TransmissionFluidCheck) as Boolean and use a check box, pretty much the way
it is done on paper.
My button would run a query that updated whatever you want to update when
the value is true.

Code is better than a macro about 99.9% of the time because you have much
more control.

If you want to mark them all passed to start, a similar query would be used
and I'd ask for a letter of recommendation before somebody pushed it and
forgot to mark the oil check false...
 
Is the purpose of the command button (with a macro) to be a shortcut for
marking everything passed? Can you just use an option group for each
category and click the appropriate radio button?

In a SetValue macro, there are two arguments that you must provide:
Item

Expression


Item is the control or property that is to receive the value that is given
in Expression. Thus if the name of the "Passed" button for Transmission
Fluid Check category were "optTFCpass", the macro action would be this:
Action: SetValue
Item: Forms!FormName!optTFCpass
Expression: True

You invoke a macro on the command button's OnClick event by saving the macro
under some name, then open the form in design view, click on the command
button control, open the Properties Window, click on the Event tab, and
click in the box next to On Click. Select the name of the macro from the
dropdown list.
 
The "O" represented the radio button for the options. I was "drawing a
picture" of what I had down on the form (I wish I could stick in a picture
of a screen capture to show what I am refering to, not as an attactment but
as part of the message, but by-laws dictate a big NO). As for the boolean
feature, are you saying that when using code, the button would change the
boolean value to true from the default of false?

Will you show me an example of code of what you said so I can get a mental
picture of what you are trying to say.

Thanks for your reply.

Dustin
 
Back
Top