TVBurke_18
New Member
- Joined
- Jul 27, 2023
- Messages
- 10
- Office Version
- 2016
- Platform
- Windows
- Web
Here
Code for Edit Command Button:
Private Sub cmdEdit_Click()
If Selected_List = 0 Then
MsgBox "No Row is selected.", vbOKOnly + vbInformatiion, "Edit"
Exit Sub
End If
'Code to udpate the value to respective controls
Me.txtRowNumber.Value = Selected_List + 1
Me.txtVendorName.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 0)
Me.txtTaskNumber.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 1)
Me.cmbVendorType.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 2)
Me.cmbSetupType.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 3)
Me.txtVendorNumber.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 4)
Me.txtVendorDepartmentNumber.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 5)
Me.txtCreationDate.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 6)
Me.txtGoLiveDate.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 7)
Me.txtEDIProvider.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 8)
MsgBox "Please make your required changes and click 'Save' to update.", vbOKOnly + vbInformation, "Edit"
End Sub
USER FORM 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 selected record?", vbYesNo + vbQuestion, "Confirmation")
If i = vbNo Then Exit Sub
ThisWorkbook.Sheets("Database").Rows(Selected_List + 1).Delete
Call Reset
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 + vbInformatiion, "Edit"
Exit Sub
End If
'Code to udpate the value to respective controls
Me.txtRowNumber.Value = Selected_List + 1
Me.txtVendorName.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 0)
Me.txtTaskNumber.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 1)
Me.cmbVendorType.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 2)
Me.cmbSetupType.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 3)
Me.txtVendorNumber.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 4)
Me.txtVendorDepartmentNumber.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 5)
Me.txtCreationDate.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 6)
Me.txtGoLiveDate.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 7)
Me.txtEDIProvider.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 8)
MsgBox "Please make your required changes and click 'Save' to update.", vbOKOnly + vbInformation, "Edit"
End Sub
Private Sub cmdReset_Click()
Dim msgValue As VbMsgBoxResult
msgValue = MsgBox("Do you want to Reset 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("Do you want to save the data?", vbYesNo + vbInformation, "Confirmation")
If msgValue = vbNo Then Exit Sub
Call Submit
Call Reset
End Sub
Private Sub CommandButton1_Click()
End Sub
Private Sub txtCreationDate_Change()
End Sub
Private Sub UserForm_Initialize()
Call Reset
End Sub
Code for Edit Command Button:
Private Sub cmdEdit_Click()
If Selected_List = 0 Then
MsgBox "No Row is selected.", vbOKOnly + vbInformatiion, "Edit"
Exit Sub
End If
'Code to udpate the value to respective controls
Me.txtRowNumber.Value = Selected_List + 1
Me.txtVendorName.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 0)
Me.txtTaskNumber.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 1)
Me.cmbVendorType.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 2)
Me.cmbSetupType.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 3)
Me.txtVendorNumber.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 4)
Me.txtVendorDepartmentNumber.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 5)
Me.txtCreationDate.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 6)
Me.txtGoLiveDate.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 7)
Me.txtEDIProvider.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 8)
MsgBox "Please make your required changes and click 'Save' to update.", vbOKOnly + vbInformation, "Edit"
End Sub
USER FORM 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 selected record?", vbYesNo + vbQuestion, "Confirmation")
If i = vbNo Then Exit Sub
ThisWorkbook.Sheets("Database").Rows(Selected_List + 1).Delete
Call Reset
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 + vbInformatiion, "Edit"
Exit Sub
End If
'Code to udpate the value to respective controls
Me.txtRowNumber.Value = Selected_List + 1
Me.txtVendorName.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 0)
Me.txtTaskNumber.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 1)
Me.cmbVendorType.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 2)
Me.cmbSetupType.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 3)
Me.txtVendorNumber.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 4)
Me.txtVendorDepartmentNumber.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 5)
Me.txtCreationDate.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 6)
Me.txtGoLiveDate.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 7)
Me.txtEDIProvider.Value = Me.lstDatabase.List(Me.lstDatabase.ListIndex, 8)
MsgBox "Please make your required changes and click 'Save' to update.", vbOKOnly + vbInformation, "Edit"
End Sub
Private Sub cmdReset_Click()
Dim msgValue As VbMsgBoxResult
msgValue = MsgBox("Do you want to Reset 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("Do you want to save the data?", vbYesNo + vbInformation, "Confirmation")
If msgValue = vbNo Then Exit Sub
Call Submit
Call Reset
End Sub
Private Sub CommandButton1_Click()
End Sub
Private Sub txtCreationDate_Change()
End Sub
Private Sub UserForm_Initialize()
Call Reset
End Sub