command button

F

Fred

I have form-1 with a button to open form-2. On form-2 I have a command button
that is disabled. What I want to do is when I’m in form-1 and opening form-2
I want the disabled button in form-2 to be enabled. Is this possible?
 
N

NetworkTrade

yes; but when you say "disabled" ; this does not explain how/why it is
disabled in true technical terms. So you need to know that, and reverse it
at an appropriate event.
 
F

Fred

I'm sorry I did not explain it fully. There are two way to view form-2. First
opening by itself via main menu, the second way by opening it through form-1.
When opening it by itself I need the command button disabled, but when
opening it through form-1 I want the command button enabled. I hope this make
a little more clear.
 
N

NetworkTrade

I would use 'Not Visible' because I don't think it to be a good user
experience to have a button that just simply does not work....or an
alternative would be to trigger a message box explaining why it is not
working....

Since opening from the Main Menu may occur first... I would set the
button's property to Not Visible. Therefore they open Form-2 direct from
main menu and it will never be Visible....

Thinking about Form-1 ....probably there is a field in this form that has
always a value greater than 0, perhaps the key index...

So that in Form-2 in the 'Open' event you can put in
If Forms!Form-1.ControlName >1 then
Me.Button.Visible = True
End If

So in this case Form-1 is open (and therefore presumably Form-2 is being
opened by Form-1). Of course this presumes knowing behavior of user and that
Form-1 would not be opened when they go to Form-2 from the Main Menu....but
overall you probably get the idea and can modify this to be better suited for
you.....
 
J

Jason

that will generate an error when opening from the menu: You need the
function ifformisopen before checking the controlname's value.
or onerror resume next just before If Forms!Form-1.ControlName >1 then
NetworkTrade said:
I would use 'Not Visible' because I don't think it to be a good user
experience to have a button that just simply does not work....or an
alternative would be to trigger a message box explaining why it is not
working....

Since opening from the Main Menu may occur first... I would set the
button's property to Not Visible. Therefore they open Form-2 direct from
main menu and it will never be Visible....

Thinking about Form-1 ....probably there is a field in this form that has
always a value greater than 0, perhaps the key index...

So that in Form-2 in the 'Open' event you can put in
If Forms!Form-1.ControlName >1 then
Me.Button.Visible = True
End If

So in this case Form-1 is open (and therefore presumably Form-2 is being
opened by Form-1). Of course this presumes knowing behavior of user and that
Form-1 would not be opened when they go to Form-2 from the Main Menu....but
overall you probably get the idea and can modify this to be better suited for
you.....
possible?
 

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