Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Update button greyed out

Update button greyed out

Scheduled Pinned Locked Moved Visual Basic
databasehelpannouncement
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Buggedforever
    wrote on last edited by
    #1

    I regret the inconvenience caused with the lengthy code pasted earlier.I'll put my query again. I am using a front end to enter some records.However for a particular record the update button is greyed out. code for update button. Private Sub cmdUpdate0_Click() Dim strAgreeStatus As String Call m_frmParent.ZOrder(0) strAgreeStatus = txtText0(idxMaintAgreeStatus).Text If Edit_Neg > 0 Then Exit Sub End If If Edit_Agree > 0 Then Exit Sub End If On Error GoTo ERR_ROUTINE Me.MousePointer = vbHourglass If strAgreeStatus = "A" Then m_objAgreement.DoFullEdits = "Y" Else m_objAgreement.DoFullEdits = "N" End If FMain.staMain.Panels(1).Text = "" DoEvents If ValidateAll0 > 0 Then FMain.staMain.Panels(1).Text = "Unable to Update. Check fields in red." GoTo SUBEND End If DoEvents If m_objAgreement.Update < 1 Then Call MsgBox("Agreement not found. " & vbCrLf & _ "", vbExclamation & vbOKOnly, "Unable to Update.") Else cboCombo0(idxMaintAgreementType).SetFocus FMain.staMain.Panels(1).Text = "Update Successful." End If SUBEND: cboCombo0(idxMaintAgreementType).SetFocus Me.MousePointer = vbNormal Exit Sub ERR_ROUTINE: If Err.Number = boAgreeErrRequired Then Call MsgBox("Unable to Update. " & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Required Data Missing") ElseIf Err.Number = boAgreeErrValidation Then Call MsgBox("Unable to Update. " & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Data Validation Error") Else Call MsgBox("Unable to Update. " & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Error") End If Me.MousePointer = vbNormal End Sub Thanks in advance. ~Varun

    S M 2 Replies Last reply
    0
    • B Buggedforever

      I regret the inconvenience caused with the lengthy code pasted earlier.I'll put my query again. I am using a front end to enter some records.However for a particular record the update button is greyed out. code for update button. Private Sub cmdUpdate0_Click() Dim strAgreeStatus As String Call m_frmParent.ZOrder(0) strAgreeStatus = txtText0(idxMaintAgreeStatus).Text If Edit_Neg > 0 Then Exit Sub End If If Edit_Agree > 0 Then Exit Sub End If On Error GoTo ERR_ROUTINE Me.MousePointer = vbHourglass If strAgreeStatus = "A" Then m_objAgreement.DoFullEdits = "Y" Else m_objAgreement.DoFullEdits = "N" End If FMain.staMain.Panels(1).Text = "" DoEvents If ValidateAll0 > 0 Then FMain.staMain.Panels(1).Text = "Unable to Update. Check fields in red." GoTo SUBEND End If DoEvents If m_objAgreement.Update < 1 Then Call MsgBox("Agreement not found. " & vbCrLf & _ "", vbExclamation & vbOKOnly, "Unable to Update.") Else cboCombo0(idxMaintAgreementType).SetFocus FMain.staMain.Panels(1).Text = "Update Successful." End If SUBEND: cboCombo0(idxMaintAgreementType).SetFocus Me.MousePointer = vbNormal Exit Sub ERR_ROUTINE: If Err.Number = boAgreeErrRequired Then Call MsgBox("Unable to Update. " & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Required Data Missing") ElseIf Err.Number = boAgreeErrValidation Then Call MsgBox("Unable to Update. " & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Data Validation Error") Else Call MsgBox("Unable to Update. " & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Error") End If Me.MousePointer = vbNormal End Sub Thanks in advance. ~Varun

      S Offline
      S Offline
      Steven J Jowett
      wrote on last edited by
      #2

      From what you have said, I do not believe the problem is within the click event of the updaste Button. I would suggest you use a breakpoint and step through you code and pay particular notice to anything where the Enabled property of the update button is used. I noticed you used a GoTo command. Tut Tut, bad coding. Avoid using them, they only lead to bad code.

      Steve Jowett ------------------------- Real programmers don't comment their code. If it was hard to write, it should be hard to read.

      B 2 Replies Last reply
      0
      • B Buggedforever

        I regret the inconvenience caused with the lengthy code pasted earlier.I'll put my query again. I am using a front end to enter some records.However for a particular record the update button is greyed out. code for update button. Private Sub cmdUpdate0_Click() Dim strAgreeStatus As String Call m_frmParent.ZOrder(0) strAgreeStatus = txtText0(idxMaintAgreeStatus).Text If Edit_Neg > 0 Then Exit Sub End If If Edit_Agree > 0 Then Exit Sub End If On Error GoTo ERR_ROUTINE Me.MousePointer = vbHourglass If strAgreeStatus = "A" Then m_objAgreement.DoFullEdits = "Y" Else m_objAgreement.DoFullEdits = "N" End If FMain.staMain.Panels(1).Text = "" DoEvents If ValidateAll0 > 0 Then FMain.staMain.Panels(1).Text = "Unable to Update. Check fields in red." GoTo SUBEND End If DoEvents If m_objAgreement.Update < 1 Then Call MsgBox("Agreement not found. " & vbCrLf & _ "", vbExclamation & vbOKOnly, "Unable to Update.") Else cboCombo0(idxMaintAgreementType).SetFocus FMain.staMain.Panels(1).Text = "Update Successful." End If SUBEND: cboCombo0(idxMaintAgreementType).SetFocus Me.MousePointer = vbNormal Exit Sub ERR_ROUTINE: If Err.Number = boAgreeErrRequired Then Call MsgBox("Unable to Update. " & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Required Data Missing") ElseIf Err.Number = boAgreeErrValidation Then Call MsgBox("Unable to Update. " & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Data Validation Error") Else Call MsgBox("Unable to Update. " & vbCrLf & vbCrLf & Err.Description, vbOKOnly, "Error") End If Me.MousePointer = vbNormal End Sub Thanks in advance. ~Varun

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        Buggedforever wrote:

        DoEvents

        Eeekkk

        Buggedforever wrote:

        On Error GoTo ERR_ROUTINE

        AAHHHHhhhh

        Buggedforever wrote:

        GoTo SUBEND

        AAAHHhhhhhh Sorry, I was not expecting VB6, I need a shower, ergh. There is a rule that discourages answerers from being sarcastic and rude but I just can't help it - VB6 make my skin crawl.

        A 1 Reply Last reply
        0
        • M Mycroft Holmes

          Buggedforever wrote:

          DoEvents

          Eeekkk

          Buggedforever wrote:

          On Error GoTo ERR_ROUTINE

          AAHHHHhhhh

          Buggedforever wrote:

          GoTo SUBEND

          AAAHHhhhhhh Sorry, I was not expecting VB6, I need a shower, ergh. There is a rule that discourages answerers from being sarcastic and rude but I just can't help it - VB6 make my skin crawl.

          A Offline
          A Offline
          Andy_L_J
          wrote on last edited by
          #4

          Mycroft Holmes wrote:

          I was not expecting VB6

          Took me a couple of seconds to recoil in horror myself X|

          I don't speak Idiot - please talk slowly and clearly I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury Driven to the arms of Heineken by the wife

          1 Reply Last reply
          0
          • S Steven J Jowett

            From what you have said, I do not believe the problem is within the click event of the updaste Button. I would suggest you use a breakpoint and step through you code and pay particular notice to anything where the Enabled property of the update button is used. I noticed you used a GoTo command. Tut Tut, bad coding. Avoid using them, they only lead to bad code.

            Steve Jowett ------------------------- Real programmers don't comment their code. If it was hard to write, it should be hard to read.

            B Offline
            B Offline
            Buggedforever
            wrote on last edited by
            #5

            Thanks for your response Steve..Havn't tried it yet but definitely share it with you..Regarding the GoTo..well the code is legacy code so can't do much :) Thanks ~Varun

            1 Reply Last reply
            0
            • S Steven J Jowett

              From what you have said, I do not believe the problem is within the click event of the updaste Button. I would suggest you use a breakpoint and step through you code and pay particular notice to anything where the Enabled property of the update button is used. I noticed you used a GoTo command. Tut Tut, bad coding. Avoid using them, they only lead to bad code.

              Steve Jowett ------------------------- Real programmers don't comment their code. If it was hard to write, it should be hard to read.

              B Offline
              B Offline
              Buggedforever
              wrote on last edited by
              #6

              Thanks a ton Steve.. My problem has been solved after a little exploration in the enable conditions. Regards Varun

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups