Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2008

Tip: Looking for answers? Try searching our database.

command button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fred - 12 May 2008 23:19 GMT
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?
NetworkTrade - 12 May 2008 23:32 GMT
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.

Signature

NTC

> 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?
Fred - 12 May 2008 23:45 GMT
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.

> 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
[quoted text clipped - 3 lines]
> > 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?
Linq Adams - 13 May 2008 04:04 GMT
You can use OpenArgs, something like this:

In Form1, when calling Form2

DoCmd.OpenForm "Form2", , , , , , "Enable"

In Form2

Private Sub Form_Load()
If Len(Nz(Me.OpenArgs, "")) > 0 Then
 If Me.OpenArgs = "Enable" Then
   YourCommandButton.Enable = True
 End If
End If
End Sub

Signature

There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

NetworkTrade - 13 May 2008 14:27 GMT
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.....

Signature

NTC

> 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.
[quoted text clipped - 9 lines]
> > > 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?
Fred - 13 May 2008 16:38 GMT
Thanks to all for your input. This really has help me going in the right
directions!

> 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
[quoted text clipped - 32 lines]
> > > > 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?
Jason - 14 May 2008 09:33 GMT
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
> 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
[quoted text clipped - 31 lines]
> > > > 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?

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.