Results 1 to 4 of 4
  1. #1
    THE STUDENT is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    11

    Buttons STOP working !!

    Private Sub Command47_Click()


    On Error GoTo Err_Command47_Click
    If Me.Command47.Caption = "Add Customer" Then
    'Add Customer enable save button and turn name to cancel
    DoCmd.GoToRecord , , acNewRec
    Me.sav_btn.Enabled = True
    Me.Command47.Caption = "Cancel"
    Me.Previous.Enabled = False
    Me.Next.Enabled = False
    Me.Command26.Enabled = False
    Me.Command25.Enabled = False
    Exit_Command47_Click:
    Exit Sub
    Err_Command47_Click:
    MsgBox Err.Description
    Resume Exit_Command47_Click
    Else
    'Cancel everything
    If Me.Dirty Then
    Me.Undo
    End If
    Me.sav_btn.Enabled = False
    Me.Command47.Caption = "Add Customer"
    Me.Requery
    End If
    End Sub


    I recently used the following code for my add customer form and it was working perfect! When the user clicked on add customer button the save button would enable (its disabled when the form opens) and the add customer button would the change to 'cancel', plus all other navigation buttons would be disable untill cancel was clicked again. (menu, previous, next & search) Now when the add customer button is clicked the save button is being enabled but when cancel is clicked the rest of the buttons are staying disabled, they would normally go back to normal. I checked with the properties for the from and navigational buttons are enabled, the code that is above is whats there, im thinking it might be something in the form properties ???? Whats even more strange is I had a back -up of the database so I thought i would just replace the form and move on, but to my dismay that one is doing the same thing !!!

    Can someone please advise

    THE STUDENT

  2. #2
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    You never enable them after the first time through.
    Me.Command26.Enabled = False
    Me.Command25.Enabled = False

    Your Save button enable looks like it will always be false.
    It is after the End IF.
    Me.sav_btn.Enabled = False

    Dale

    EDIT:
    BTW, a good practice is to give your controls a meaningful name this helps to troubleshoot now and in the future.

  3. #3
    THE STUDENT is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    11
    Im new at access so im not familiar with the code, initailly that code was working just fine, if its not a problem can you send what the code was suppose to be like? its still kinda strange though, as even my backup before this problem is doing the same, and it was not even stored on my computer

  4. #4
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Add Option Explicit to the top of your code window.
    I doubt that this code would compile as it was.

    Code:
    Private Sub Command47_Click()
       On Error GoTo Err_Command47_Click ' Name this command button something meaningful. Nobody knows what it is when debuging for you
       If Me.Command47.Caption = "Add Customer" Then 'Same here.
          'Add Customer enable save button and turn name to cancel
          DoCmd.GoToRecord , , acNewRec
          Me.sav_btn.Enabled = True
          Me.Command47.Caption = "Cancel"
          Me.Previous.Enabled = False 'Not sure what this means. I have never seen this command
          Me.Next.Enabled = False      ' Or this one
          Me.Command26.Enabled = False  'You disabled some command button 
          Me.Command25.Enabled = False  'Disable another command button
    Exit_Command47_Click:
          Exit Sub                              'Exit sub If Me.Command47.Caption = "Add Customer"
    Err_Command47_Click:
          MsgBox Err.Description
          Resume Exit_Command47_Click
       ElseIf  Me.Dirty Then      ' Don't understand why this is here. What are you wanting to check?
          'Cancel everything
     Me.Command26.Enabled = True 'Do not know what this command button is.
          Me.Command25.Enabled = True   'Or this one     
             Me.Undo                            ' Cancel
          End If
          Me.sav_btn.Enabled = False     ' Save button diabled
          Me.Command47.Caption = "Add Customer"
          Me.Requery
       End If
    End Sub

    Dale

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

Similar Threads

  1. Navigational Buttons STOP working !!
    By THE STUDENT in forum Access
    Replies: 6
    Last Post: 06-11-2013, 04:20 PM
  2. cascading combo boxes stop working in DAP system
    By James Brazill in forum Forms
    Replies: 5
    Last Post: 06-28-2011, 03:51 AM
  3. Replies: 9
    Last Post: 03-29-2011, 07:08 PM
  4. Navigation Buttons Stop My Code
    By millerdav99 in forum Programming
    Replies: 6
    Last Post: 03-18-2011, 11:13 AM

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