Click buttons after Update...

B

Ben

I have 2 buttons on my main form and am working in a subform... now when a
certain value is selected in my subform, I would like to execute
(afterUpdate) the VBA procedures behind the onclick properties...

How do I make access click ?




Details (Button 1 makes Subform 1 visible, and editable... when visible,
button1 click makes subform1 unvisible and saves and refreshes the mainform.
Button2 does the same but for subform2. Now when a value is set in subform1,
I need to go to subform2 and I would lick the two clicks to be executed...)
 
R

roadie.girl

Ok - so you can kill me if this is not what you are asking for ...
but for you "OnClick" event, what you want to do is open the form in
design view
then right click on the button/field/thing that you want to have the
"OnClick" event
then go to properties ... this shows you the basic properties that
microsoft lets you edit (you can edit more, you jsut have to write code
for it, whcih isn't bad)
Now click on the "event" tab on the top of the form
about half way down you'll see a "OnClick" and an "OnDoubleClick" line
click in whichever line you'd like
click on the "..." button to the very right of the screen
then select the method to be ....something
CodeBuilder - you can write VBA code which is probably the best way to
go
ExpressionBuilder = you can write formulas, assign values, with the MS
expression builder
MacroBuilder = standard macro builder. code builder is much easier to
use and has way more versatility.

answer your question?
 
O

Ofer

Instead of running the click, run the sub of the OnClick event of the button

Form_MainFormName.ButtonName_Click
 
B

Ben

Hmm, it says that it doesn't find my Button... Could it be that it doesn't
find it because I have it on a tabControl ?

Form_AllinOneDoctor.Kommandoknapp74_Click
 
B

Ben

Ehm, not really... but thanks, it was a good explanation.

I already have the code behind my button (onClick) but I would like to have
it run automatically, when I change some data in a subform somewhere.
 
D

Dirk Goldgar

Ben said:
I have 2 buttons on my main form and am working in a subform... now
when a certain value is selected in my subform, I would like to
execute (afterUpdate) the VBA procedures behind the onclick
properties...

How do I make access click ?




Details (Button 1 makes Subform 1 visible, and editable... when
visible, button1 click makes subform1 unvisible and saves and
refreshes the mainform. Button2 does the same but for subform2. Now
when a value is set in subform1, I need to go to subform2 and I would
lick the two clicks to be executed...)

If you look at the two Click event procedures for the buttons on the
main form, you'll see that they are defined as Private; for example,

Private Sub Command1_Click()

Change that to Public:

Public Sub Command1_Click()

Then, in the subform, call those procedures, qualified by the a
reference to the subform's Parent property, like this:

Call Me.Parent.Command1_Click
 
Top