Hello All,
Both forms below are assigned to the same worksheet. The ambiguous name is "reset" because they both have a delete and reset button. Should I rename part of the 'reset code' for the second form? Which part? Below is the code from each.
Form 1 Code:
Form 2 code:
Thank you,
Tony
Both forms below are assigned to the same worksheet. The ambiguous name is "reset" because they both have a delete and reset button. Should I rename part of the 'reset code' for the second form? Which part? Below is the code from each.
Form 1 Code:
VBA Code:
Private Sub cmdDelete_Click()
If Selected_List = 0 Then
MsgBox "No row is selected.", vbOKOnly + vbInformation, "Delete"
Exit Sub
End If
Dim i As VbMsgBoxResult
i = MsgBox("Do you want to delete the selected record?", vbYesNo + vbQuestion, "Confirmation")
If i = vbNo Then Exit Sub
ThisWorkbook.Sheets("Database").Rows(Selected_List + 1).Delete
Call Reset 'THE ERROR MESSEGE IS HERE : AMBIGUOUS NAME DETECTED
MsgBox "Selected record has been deleted.", vbOKOnly + vbInformation, "Deleted"
End Sub
Private Sub cmdEdit_Click()
If Selected_List = 0 Then
MsgBox "No row is selected.", vbOKOnly + vbInformation, "Edit"
Exit Sub
End If
'Code to update the value to respective controls
Dim sPR As String
Me.txtRowNumber.Value = Selected_List + 1
Me.txtnumber.Value = Me.lbdatabase.List(Me.lbdatabase.ListIndex, 1)
Me.Txttitle.Value = Me.lbdatabase.List(Me.lbdatabase.ListIndex, 2)
Me.lbsystem.Value = Me.lbdatabase.List(Me.lbdatabase.ListIndex, 3)
sPR = Me.lbdatabase.List(Me.lbdatabase.ListIndex, 4)
If sPR = "Y" Then
Me.optyes.Value = True
Else
Me.optno.Value = True
End If
Me.lbdefectcode.Value = Me.lbdatabase.List(Me.lbdatabase.ListIndex, 5)
Me.lbexpected.Value = Me.lbdatabase.List(Me.lbdatabase.ListIndex, 6)
Me.lbactual.Value = Me.lbdatabase.List(Me.lbdatabase.ListIndex, 7)
Me.txtproblem.Value = Me.lbdatabase.List(Me.lbdatabase.ListIndex, 8)
Me.txtnotes.Value = Me.lbdatabase.List(Me.lbdatabase.ListIndex, 9)
MsgBox "Please make the required changes and click on 'Save' button to update.", vbOKOnly + vbInformation, "Edit"
End Sub
Private Sub cmdReset_Click()
Dim msgValue As VbMsgBoxResult
msgValue = MsgBox("Do you want to rerest the form?", vbYesNo + vbInformation, "Confirmation")
If msgValue = vbNo Then Exit Sub
Call Reset '
End Sub
Private Sub cmdSave_Click()
Dim msgValue As VbMsgBoxResult
msgValue = MsgBox("Please check you entries and confirm you want to save the data", vbYesNo + vbInformation, "Confirmation")
If msgValue = vbNo Then Exit Sub
Call Submit
Call Reset
End Sub
Form 2 code:
VBA Code:
Private Sub cmdReset_Click()
Dim msgValue As VbMsgBoxResult
msgValue = MsgBox("Do you want to rerest the form?", vbYesNo + vbInformation, "Confirmation")
If msgValue = vbNo Then Exit Sub
Call Reset
End Sub
Private Sub cmdSave_Click()
Dim msgValue As VbMsgBoxResult
msgValue = MsgBox("Please check you entries and confirm you want to save the data", vbYesNo + vbInformation, "Confirmation")
If msgValue = vbNo Then Exit Sub
Call Submit
Call Reset
End Sub
Thank you,
Tony