Control Form form a Sub Form

T

TonyAntique

How do I activate a command button on the main form when I double click on
the sub form?
 
A

Allen Browne

TonyAntique said:
How do I activate a command button on the main form when I double click
on the sub form?

The code would be like this:
Me.Parent!Command99.Enabled = True

But you'll need to define "double-click on the subform" more precisely. It's
probably the dblClick event of the subform's Detail section you want to use.
 
T

TonyAntique via AccessMonster.com

Allen many thanks.
I am sorry I wasn't precise enough .
Me.Parent!Command99.Enabled = True will make it active or not (True or False)
but I wanted to trigger the command button from the sub form.
Me.Parent!Command99_Click causes Run-time error'438' not supported.

I'm sure the answer is simple but I just can't find it!
 
D

Douglas J. Steele

Allen told you how to enable a command button on the parent form, not how to
run the code associated with the button's Click event.

To have it call the code, you'd need

Call Me.Parent.Command99_Click

Note that you'll need to change the declaration for Command99_Click from

Private Sub Command99_Click()

to

Public Sub Command99_Click()

Incidentally, do yourself a HUGE favour, and start renaming your controls so
that they're more meaningful.
 
T

TonyAntique via AccessMonster.com

Thanks
Allen told you how to enable a command button on the parent form, not how to
run the code associated with the button's Click event.

To have it call the code, you'd need

Call Me.Parent.Command99_Click

Note that you'll need to change the declaration for Command99_Click from

Private Sub Command99_Click()

to

Public Sub Command99_Click()

Incidentally, do yourself a HUGE favour, and start renaming your controls so
that they're more meaningful.
Allen many thanks.
I am sorry I wasn't precise enough .
[quoted text clipped - 15 lines]
 

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