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  

button question: two different commands?



 
 
Thread Tools Display Modes
  #1  
Old May 31st, 2007, 09:04 AM posted to microsoft.public.access.forms
scubadiver
external usenet poster
 
Posts: 1,673
Default button question: two different commands?


Is it at all possible to use the same button for two different commands. I
want to make a subform visible and invisible with the same button.


  #2  
Old May 31st, 2007, 09:47 AM posted to microsoft.public.access.forms
Baz
external usenet poster
 
Posts: 380
Default button question: two different commands?

Private Sub cmdButton_Click()

frmSubform.Visible = Not frmSubform.Visible

End Sub

"scubadiver" wrote in message
...

Is it at all possible to use the same button for two different commands. I
want to make a subform visible and invisible with the same button.




  #3  
Old May 31st, 2007, 10:28 AM posted to microsoft.public.access.forms
scubadiver
external usenet poster
 
Posts: 1,673
Default button question: two different commands?


I have inserted the following single line

Me.ComQry.Visible = Not Me.ComQry.Visible

but nothing is happening.



"Baz" wrote:

Private Sub cmdButton_Click()

frmSubform.Visible = Not frmSubform.Visible

End Sub

"scubadiver" wrote in message
...

Is it at all possible to use the same button for two different commands. I
want to make a subform visible and invisible with the same button.





  #4  
Old May 31st, 2007, 10:33 AM posted to microsoft.public.access.forms
Baz
external usenet poster
 
Posts: 380
Default button question: two different commands?

Inserted it where?

"scubadiver" wrote in message
...

I have inserted the following single line

Me.ComQry.Visible = Not Me.ComQry.Visible

but nothing is happening.



"Baz" wrote:

Private Sub cmdButton_Click()

frmSubform.Visible = Not frmSubform.Visible

End Sub

"scubadiver" wrote in message
...

Is it at all possible to use the same button for two different

commands. I
want to make a subform visible and invisible with the same button.







  #5  
Old May 31st, 2007, 10:43 AM posted to microsoft.public.access.forms
scubadiver
external usenet poster
 
Posts: 1,673
Default button question: two different commands?


Private Sub CompQry_Click()

Me.ComQry.Visible = Not Me.ComQry.Visible

End Sub

in the button code on the main form

"Baz" wrote:

Inserted it where?

"scubadiver" wrote in message
...

I have inserted the following single line

Me.ComQry.Visible = Not Me.ComQry.Visible

but nothing is happening.



"Baz" wrote:

Private Sub cmdButton_Click()

frmSubform.Visible = Not frmSubform.Visible

End Sub

"scubadiver" wrote in message
...

Is it at all possible to use the same button for two different

commands. I
want to make a subform visible and invisible with the same button.








  #6  
Old May 31st, 2007, 10:56 AM posted to microsoft.public.access.forms
Baz
external usenet poster
 
Posts: 380
Default button question: two different commands?

Is ComQry the name of the subform control?

In the property sheet for the command button (CompQry?), Event tab, make
sure that [Event Procedure] is selected against "On Click".

"scubadiver" wrote in message
...

Private Sub CompQry_Click()

Me.ComQry.Visible = Not Me.ComQry.Visible

End Sub

in the button code on the main form

"Baz" wrote:

Inserted it where?

"scubadiver" wrote in message
...

I have inserted the following single line

Me.ComQry.Visible = Not Me.ComQry.Visible

but nothing is happening.



"Baz" wrote:

Private Sub cmdButton_Click()

frmSubform.Visible = Not frmSubform.Visible

End Sub

"scubadiver" wrote in message
...

Is it at all possible to use the same button for two different

commands. I
want to make a subform visible and invisible with the same button.










  #7  
Old May 31st, 2007, 12:40 PM posted to microsoft.public.access.forms
BruceM[_2_]
external usenet poster
 
Posts: 1,763
Default button question: two different commands?

Are CompQry and ComQry two different controls? If so, what is ComQry?

"scubadiver" wrote in message
...

Private Sub CompQry_Click()

Me.ComQry.Visible = Not Me.ComQry.Visible

End Sub

in the button code on the main form

"Baz" wrote:

Inserted it where?

"scubadiver" wrote in message
...

I have inserted the following single line

Me.ComQry.Visible = Not Me.ComQry.Visible

but nothing is happening.



"Baz" wrote:

Private Sub cmdButton_Click()

frmSubform.Visible = Not frmSubform.Visible

End Sub

"scubadiver" wrote in message
...

Is it at all possible to use the same button for two different

commands. I
want to make a subform visible and invisible with the same button.










  #8  
Old May 31st, 2007, 01:05 PM posted to microsoft.public.access.forms
scubadiver
external usenet poster
 
Posts: 1,673
Default button question: two different commands?


That is correct but still nothing.




"Baz" wrote:

Is ComQry the name of the subform control?

In the property sheet for the command button (CompQry?), Event tab, make
sure that [Event Procedure] is selected against "On Click".

"scubadiver" wrote in message
...

Private Sub CompQry_Click()

Me.ComQry.Visible = Not Me.ComQry.Visible

End Sub

in the button code on the main form

"Baz" wrote:

Inserted it where?

"scubadiver" wrote in message
...

I have inserted the following single line

Me.ComQry.Visible = Not Me.ComQry.Visible

but nothing is happening.



"Baz" wrote:

Private Sub cmdButton_Click()

frmSubform.Visible = Not frmSubform.Visible

End Sub

"scubadiver" wrote in message
...

Is it at all possible to use the same button for two different
commands. I
want to make a subform visible and invisible with the same button.











  #9  
Old May 31st, 2007, 01:16 PM posted to microsoft.public.access.forms
scubadiver
external usenet poster
 
Posts: 1,673
Default button question: two different commands?


I appreciate that could be a source of difficulty so I have changed it.

The button is called "CompQryButton" and the subform control is called
"comqry". The code I now have in the "on click" event is:

Private Sub CompQryButton_Click()

Me.ComQry.Visible = Not Me.ComQry.Visible

End Sub








"BruceM" wrote:

Are CompQry and ComQry two different controls? If so, what is ComQry?

"scubadiver" wrote in message
...

Private Sub CompQry_Click()

Me.ComQry.Visible = Not Me.ComQry.Visible

End Sub

in the button code on the main form

"Baz" wrote:

Inserted it where?

"scubadiver" wrote in message
...

I have inserted the following single line

Me.ComQry.Visible = Not Me.ComQry.Visible

but nothing is happening.



"Baz" wrote:

Private Sub cmdButton_Click()

frmSubform.Visible = Not frmSubform.Visible

End Sub

"scubadiver" wrote in message
...

Is it at all possible to use the same button for two different
commands. I
want to make a subform visible and invisible with the same button.











  #10  
Old May 31st, 2007, 01:25 PM posted to microsoft.public.access.forms
Baz
external usenet poster
 
Posts: 380
Default button question: two different commands?

Set a breakpoint in the event procedure to find out if it is actually
running when you click the button.

"scubadiver" wrote in message
...

I appreciate that could be a source of difficulty so I have changed it.

The button is called "CompQryButton" and the subform control is called
"comqry". The code I now have in the "on click" event is:

Private Sub CompQryButton_Click()

Me.ComQry.Visible = Not Me.ComQry.Visible

End Sub








"BruceM" wrote:

Are CompQry and ComQry two different controls? If so, what is ComQry?

"scubadiver" wrote in message
...

Private Sub CompQry_Click()

Me.ComQry.Visible = Not Me.ComQry.Visible

End Sub

in the button code on the main form

"Baz" wrote:

Inserted it where?

"scubadiver" wrote in message
...

I have inserted the following single line

Me.ComQry.Visible = Not Me.ComQry.Visible

but nothing is happening.



"Baz" wrote:

Private Sub cmdButton_Click()

frmSubform.Visible = Not frmSubform.Visible

End Sub

"scubadiver" wrote in

message
...

Is it at all possible to use the same button for two different
commands. I
want to make a subform visible and invisible with the same

button.













 




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 03:07 AM.


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