Update button greyed out
-
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
-
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
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.
-
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
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.
-
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.
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
-
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.
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
-
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.
Thanks a ton Steve.. My problem has been solved after a little exploration in the enable conditions. Regards Varun