hide a button on a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a button on a form which brings up another form. However, I only want
this button to appear when a specific toggle button is toggled on. I've tried
everything I can think of with the Me.[Button].Visible command but to no
avail. What do I need to do to make this work?
 
If Toggle0 = False Then
Set focus = Command1
Command1.Visible = False
Else
If Toggle0 = True Then
Set focus = Command1
Command1.Visible = True
End If
End If
 
Nicholas said:
I have a button on a form which brings up another form. However, I only want
this button to appear when a specific toggle button is toggled on. I've tried
everything I can think of with the Me.[Button].Visible command but to no
avail. What do I need to do to make this work?


Try adding the line:
Me.Button.Visible = Me.toggle
to both the toggle's AfterUpdate and the form's Current
event procedures.
 
Thank you Jessie and Marshall. I guess I'm showing my ineptitude in my forms
programming because I tried both of these methods and I kept getting "You
have entered an expression that contains no value" for Jessie's code and
"Microsoft Access cannot find macro name "Me"" for Marshall's. I'm not sure
what to do at this point. I can't very well make the toggle buttons regular
buttons because I really need to have one or the other, I can't have both
buttons pressed. (The form controls debit and refund entry and it's kinda
hard for a single transaction to be a debit and a refund at the same time.)
Not to mention the fact that if I take out the toggles I would have to
redesign about 15 forms and rework my database code. What I'm trying to do is
have a button pop up that allows additional options to be entered in the
event that the user is inputting a refund into the system. These additional
options are not applicable to charges. I would just put the button on there
and let the user figure it out, but the possibility of user error would cause
mass havoc if someone were to change this data on a charge transaction.

Jessie said:
If Toggle0 = False Then
Set focus = Command1
Command1.Visible = False
Else
If Toggle0 = True Then
Set focus = Command1
Command1.Visible = True
End If
End If



Nicholas Scarpinato said:
I have a button on a form which brings up another form. However, I only want
this button to appear when a specific toggle button is toggled on. I've tried
everything I can think of with the Me.[Button].Visible command but to no
avail. What do I need to do to make this work?
 
Nicholas said:
I have a button on a form which brings up another form. However, I only want
this button to appear when a specific toggle button is toggled on. I've tried
everything I can think of with the Me.[Button].Visible command but to no
avail. What do I need to do to make this work?


Nicholas,

On the form's Onopen event property put this:
cmdButtonName.visible=False

On the frame that contains the toggle button put this:
If optToggleName.value=1 then
cmdButtonName.visible=True
cmdButtonName.SetFocus
Else
cmdButtonName.visible=False
End If
 
Nicholas said:
Thank you Jessie and Marshall. I guess I'm showing my ineptitude in my forms
programming because I tried both of these methods and I kept getting "You
have entered an expression that contains no value" for Jessie's code and
"Microsoft Access cannot find macro name "Me"" for Marshall's. I'm not sure
what to do at this point. I can't very well make the toggle buttons regular
buttons because I really need to have one or the other, I can't have both
buttons pressed. (The form controls debit and refund entry and it's kinda
hard for a single transaction to be a debit and a refund at the same time.)
Not to mention the fact that if I take out the toggles I would have to
redesign about 15 forms and rework my database code. What I'm trying to do is
have a button pop up that allows additional options to be entered in the
event that the user is inputting a refund into the system. These additional
options are not applicable to charges. I would just put the button on there
and let the user figure it out, but the possibility of user error would cause
mass havoc if someone were to change this data on a charge transaction.


It sounds like the option button is part of an option group.
In this case the code wuold have to check the option frame's
value instead of the option button, which doesn't have a
value when it's in a group.

It also sound like you put the code in the wrong place. It
is supposed to be in the appropriate Event **procedure**,
not in a macro and not in a form or control event property.
 
Back
Top