Results 1 to 4 of 4
  1. #1
    Alex Motilal is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2008
    Location
    Coimbatore, India
    Posts
    193

    Code help

    Hi Everybody


    When the “VIEW COUNTRY WISE PLAYERS” (Command21) on the 1st Form is clicked, the Form “PlayersEntryForm” opens and the Caption changes to “HIDE PLAYERS ENTRY FORM”. Again when the button is clicked the “PlayersEntryForm” hides. Following is the code which works fine.
    Private Sub Command21_Click()
    If Me.Command21.Caption = "VIEW COUNTRY WISE PLAYERS" Then
    DoCmd.OpenForm "PlayersEntryForm"
    Me.Command21.Caption = "HIDE PLAYERS ENTRY FORM"
    Else
    DoCmd.Close acForm, "PlayersEntryForm"


    Me.Command21.Caption = "VIEW COUNTRY WISE PLAYERS"
    End If
    End Sub
    What I want is, the “Command2” button on the “PlayersEntryForm” should be disabled.
    Can anyone please guide me what line I should include in the above code.
    Thanks in advance.

  2. #2
    evander is offline Competent Performer
    Windows 7 Access 2003
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    206
    Form_PlayersEntryForm.Command2.Enabled = False

    Question: Disabled when?

  3. #3
    Alex Motilal is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2008
    Location
    Coimbatore, India
    Posts
    193
    Thank you enander. However the the soultion didn't solve the problem. Command2 button of the PlayersEntryForm should disabled when it is opened through the 1st Form.

  4. #4
    evander is offline Competent Performer
    Windows 7 Access 2003
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    206
    Alex, the code will not work if the only control that you've got on your form is the command button that you want to disable.

    You can take a look at the code I included in this database.
    http://rapidshare.com/files/400025346/Disable.mdb.html

    Place a code that shifts the focus away from the command button you want to disable.

    Hope this helps.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Help with code
    By steve183 in forum Programming
    Replies: 2
    Last Post: 06-04-2010, 05:14 PM
  2. Access 2003 code vs Access 2007 Code
    By ralphjramirez in forum Access
    Replies: 5
    Last Post: 11-23-2009, 12:33 PM
  3. Help with VBA Code
    By access.newby in forum Forms
    Replies: 1
    Last Post: 11-15-2009, 05:43 AM
  4. Help with vba code
    By rockape in forum Programming
    Replies: 11
    Last Post: 09-29-2009, 06:49 AM
  5. Need help with code
    By hoenheim in forum Programming
    Replies: 9
    Last Post: 09-11-2008, 04:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums