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  

Disable Command Button



 
 
Thread Tools Display Modes
  #1  
Old December 4th, 2006, 11:52 PM posted to microsoft.public.access.forms
mdavis via AccessMonster.com
external usenet poster
 
Posts: 15
Default Disable Command Button

I would like to click a command button called "Save" on Form "A" and as Form
"A" closes and returns me to Form "B" I would like to make a command button
on Form "B" to be disabled.

Thank you in advance.

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

  #2  
Old December 5th, 2006, 12:30 AM posted to microsoft.public.access.forms
fredg
external usenet poster
 
Posts: 4,386
Default Disable Command Button

On Mon, 04 Dec 2006 22:52:41 GMT, mdavis via AccessMonster.com wrote:

I would like to click a command button called "Save" on Form "A" and as Form
"A" closes and returns me to Form "B" I would like to make a command button
on Form "B" to be disabled.

Thank you in advance.


What do you mean by 'and returns me to Form "B"?
Is Form B opened by Form A?

In the Command Button Save click event:

' Place your current Save code here.
DoCmd.OpenForm "FormB"
forms!FormB!CommandButtonName.Enabled = False

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #3  
Old December 6th, 2006, 04:44 PM posted to microsoft.public.access.forms
mdavis via AccessMonster.com
external usenet poster
 
Posts: 15
Default Disable Command Button

Sorry I did not give the proper info.
Form B is the main form and is already opened. The user clicks a command
button called ADD (on Form B) that takes them to a pop up form (Form A).
Then if the user clicks the SAVE command button I want the ADD command button
to be disabled on Form B.

I added the code you gave me but I get an error that says "You can't disable
a control while it has the focus". Do you know what the code would be to fix
this?

Thanks for all your help.


fredg wrote:
I would like to click a command button called "Save" on Form "A" and as Form
"A" closes and returns me to Form "B" I would like to make a command button
on Form "B" to be disabled.

Thank you in advance.


What do you mean by 'and returns me to Form "B"?
Is Form B opened by Form A?

In the Command Button Save click event:

' Place your current Save code here.
DoCmd.OpenForm "FormB"
forms!FormB!CommandButtonName.Enabled = False


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

  #4  
Old December 6th, 2006, 06:21 PM posted to microsoft.public.access.forms
fredg
external usenet poster
 
Posts: 4,386
Default Disable Command Button

On Wed, 06 Dec 2006 15:44:51 GMT, mdavis via AccessMonster.com wrote:

Sorry I did not give the proper info.
Form B is the main form and is already opened. The user clicks a command
button called ADD (on Form B) that takes them to a pop up form (Form A).
Then if the user clicks the SAVE command button I want the ADD command button
to be disabled on Form B.

I added the code you gave me but I get an error that says "You can't disable
a control while it has the focus". Do you know what the code would be to fix
this?

Thanks for all your help.

fredg wrote:
I would like to click a command button called "Save" on Form "A" and as Form
"A" closes and returns me to Form "B" I would like to make a command button
on Form "B" to be disabled.

Thank you in advance.


What do you mean by 'and returns me to Form "B"?
Is Form B opened by Form A?

In the Command Button Save click event:

' Place your current Save code here.
DoCmd.OpenForm "FormB"
forms!FormB!CommandButtonName.Enabled = False


Sure.
Forms!FormB!AnyOtherControl.SetFocus
Forms!FormB!CommandButton.Enabled = False
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #5  
Old December 6th, 2006, 07:52 PM posted to microsoft.public.access.forms
mdavis via AccessMonster.com
external usenet poster
 
Posts: 15
Default Disable Command Button

Works like a charm. Thanks again.

fredg wrote:
Sorry I did not give the proper info.
Form B is the main form and is already opened. The user clicks a command

[quoted text clipped - 22 lines]
DoCmd.OpenForm "FormB"
forms!FormB!CommandButtonName.Enabled = False


Sure.
Forms!FormB!AnyOtherControl.SetFocus
Forms!FormB!CommandButton.Enabled = False


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

  #6  
Old December 9th, 2006, 06:44 PM posted to microsoft.public.access.forms
mdavis via AccessMonster.com
external usenet poster
 
Posts: 15
Default Disable Command Button

One more thing. When I close Form B and reopen it the command button is
enabled.
I would like the command button to be disabled as long as Combo Box B has a
value in it. If there isn't a value in the Combo Box than I would like the
Command Button to be enabled.
Could you please help me with the code for this?

Thank you.



fredg wrote:
Sorry I did not give the proper info.
Form B is the main form and is already opened. The user clicks a command

[quoted text clipped - 22 lines]
DoCmd.OpenForm "FormB"
forms!FormB!CommandButtonName.Enabled = False


Sure.
Forms!FormB!AnyOtherControl.SetFocus
Forms!FormB!CommandButton.Enabled = False


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

  #7  
Old December 9th, 2006, 08:07 PM posted to microsoft.public.access.forms
fredg
external usenet poster
 
Posts: 4,386
Default Disable Command Button

On Sat, 09 Dec 2006 17:44:59 GMT, mdavis via AccessMonster.com wrote:

One more thing. When I close Form B and reopen it the command button is
enabled.
I would like the command button to be disabled as long as Combo Box B has a
value in it. If there isn't a value in the Combo Box than I would like the
Command Button to be enabled.
Could you please help me with the code for this?

Thank you.



fredg wrote:
Sorry I did not give the proper info.
Form B is the main form and is already opened. The user clicks a command

[quoted text clipped - 22 lines]
DoCmd.OpenForm "FormB"
forms!FormB!CommandButtonName.Enabled = False


Sure.
Forms!FormB!AnyOtherControl.SetFocus
Forms!FormB!CommandButton.Enabled = False


Code the Form's Current event:
Me!CommandButtonName.Enabled = Not IsNull(ComboB)

in which case there will most likely be no need to set it from FormA.

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #8  
Old December 13th, 2006, 05:49 AM posted to microsoft.public.access.forms
mdavis via AccessMonster.com
external usenet poster
 
Posts: 15
Default Disable Command Button

This works great.
But now if I delete the record that is in COMBO B how do I make the COMMAND
BUTTON enabled so that I can enter another record?

fredg wrote:
One more thing. When I close Form B and reopen it the command button is
enabled.

[quoted text clipped - 16 lines]
Forms!FormB!AnyOtherControl.SetFocus
Forms!FormB!CommandButton.Enabled = False


Code the Form's Current event:
Me!CommandButtonName.Enabled = Not IsNull(ComboB)

in which case there will most likely be no need to set it from FormA.


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

  #9  
Old December 13th, 2006, 07:03 AM posted to microsoft.public.access.forms
fredg
external usenet poster
 
Posts: 4,386
Default Disable Command Button

On Wed, 13 Dec 2006 04:49:16 GMT, mdavis via AccessMonster.com wrote:

This works great.
But now if I delete the record that is in COMBO B how do I make the COMMAND
BUTTON enabled so that I can enter another record?

fredg wrote:
One more thing. When I close Form B and reopen it the command button is
enabled.

[quoted text clipped - 16 lines]
Forms!FormB!AnyOtherControl.SetFocus
Forms!FormB!CommandButton.Enabled = False


Code the Form's Current event:
Me!CommandButtonName.Enabled = Not IsNull(ComboB)

in which case there will most likely be no need to set it from FormA.


Place the same code in the ComboB AfterUpdate event.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #10  
Old December 14th, 2006, 12:02 AM posted to microsoft.public.access.forms
mdavis via AccessMonster.com
external usenet poster
 
Posts: 15
Default Disable Command Button

The COMMAND BUTTON stays disabled? I can't seem to get it to be enabled
after I delete the record.

I probably should've mentioned that the control that you are referring to as
"Combo B" is actually an unbound List Box. In order to edit or delete the
record in the List Box I click on an EDIT COMMAND BUTTON which opens up
another form for me to edit the record or click on a DELETE COMMAND BUTTON to
delete the record.

Should I be placing the code somewhere else instead of the LIST BOX?

I apologize for not supplying you with all of the info. I was trying to keep
it as simple as possible.

fredg wrote:
This works great.
But now if I delete the record that is in COMBO B how do I make the COMMAND

[quoted text clipped - 10 lines]

in which case there will most likely be no need to set it from FormA.


Place the same code in the ComboB AfterUpdate event.


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

 




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 01:58 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.