A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Control Form form a Sub Form



 
 
Thread Tools Display Modes
  #1  
Old March 27th, 2010, 08:51 PM posted to microsoft.public.access.forms
TonyAntique
external usenet poster
 
Posts: 1
Default Control Form form a Sub Form

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

  #2  
Old March 28th, 2010, 02:33 AM posted to microsoft.public.access.forms
Allen Browne
external usenet poster
 
Posts: 11,706
Default Control Form form a Sub Form

"TonyAntique" u59027@uwe wrote in message news:a5a6118d13dbf@uwe...
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.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

  #3  
Old March 28th, 2010, 07:09 PM posted to microsoft.public.access.forms
TonyAntique via AccessMonster.com
external usenet poster
 
Posts: 4
Default Control Form form a Sub Form

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!

Allen Browne wrote:
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.


--
Message posted via http://www.accessmonster.com

  #4  
Old March 28th, 2010, 08:46 PM posted to microsoft.public.access.forms
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default Control Form form a Sub Form

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.


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"TonyAntique via AccessMonster.com" u59027@uwe wrote in message
news:a5b1c09b9617b@uwe...
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!

Allen Browne wrote:
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.


--
Message posted via http://www.accessmonster.com



  #5  
Old March 28th, 2010, 09:59 PM posted to microsoft.public.access.forms
TonyAntique via AccessMonster.com
external usenet poster
 
Posts: 4
Default Control Form form a Sub Form

Thanks

Douglas J. Steele wrote:
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]
probably the dblClick event of the subform's Detail section you want to
use.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201003/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:39 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.