Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
(OP)
Hi, I encountered force closed when saving. Error was not displayed,
Can anyone help me? Thank you.
Here's my code.
Can anyone help me? Thank you.
Here's my code.
CODE --> VBA
Private Sub cmdSave_Click() Dim cnn As New ADODB.Connection Dim rst As New ADODB.Recordset Dim qry As String cnn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & ThisWorkbook.Path & "\Database.accdb" If Me.txtId.Value <> "" Then qry = "SELECT * FROM TBL_Customer WHERE ID = " & Me.txtId.Value Else qry = "SELECT * FROM TBL_Customer Where ID = 0" End If rst.Open qry, cnn, adOpenKeyset, adLockOptimistic If rst.RecordCount = 0 Then rst.AddNew End If rst.Fields("Sen").Value = Me.cmbShift.Value rst.Fields("Date").Value = VBA.CDate(Me.txtDate.Value) rst.Fields("Lot").Value = Me.txtLot.Value rst.Fields("Product").Value = Me.txtPN.Value rst.Fields("Item_No").Value = Me.txtItem.Value rst.Fields("Serial_No").Value = Me.txtSerial.Value rst.Fields("Line_No").Value = Me.cmbLine.Value rst.Fields("Shift").Value = Me.cmbShift1.Value rst.Fields("Defect").Value = Me.cmbDefect.Value rst.Fields("Details_of_Defect").Value = Me.txtDet.Value rst.Fields("Connector_Name").Value = Me.txtCon.Value rst.Fields("Quantity").Value = Me.txtQty.Value rst.Fields("Process").Value = Me.txtProcess.Value rst.Fields("Detection_of_Defect").Value = Me.cmbDetection.Value rst.Fields("Responsible_Person").Value = Me.cmbResPer.Value rst.Fields("Responsible_Leader").Value = Me.cmbResLead.Value rst.Fields("Repair_Personnel").Value = Me.cmbRepair.Value rst.Fields("Removed_Details").Value = Me.txtRemoved.Value rst.Fields("Repair_and_Install_Details").Value = Me.txtIns.Value rst.Fields("Standard").Value = Me.txtStd.Value rst.Fields("Confirmed_by").Value = Me.txtConf.Value rst.Fields("Category").Value = Me.cmbCat.Value rst.Fields("Remarks").Value = Me.txtRemark.Value rst.Fields("Encoder").Value = Me.txtuser.Value rst.Fields("Time Encoded").Value = VBA.Now rst.Update Me.txtId.Value = "" Me.cmbShift.Value = "" Me.txtDate.Value = "" Me.txtLot.Value = "" Me.txtPN.Value = "" Me.txtItem.Value = "" Me.txtSerial.Value = "" Me.cmbLine.Value = "" Me.cmbShift1.Value = "" Me.cmbDefect.Value = "" Me.txtDet.Value = "" Me.txtCon.Value = "" Me.txtQty.Value = "" Me.txtProcess.Value = "" Me.cmbDetection.Value = "" Me.cmbResPer.Value = "" Me.cmbResLead.Value = "" Me.cmbRepair.Value = "" Me.txtRemoved.Value = "" Me.txtIns.Value = "" Me.txtStd.Value = "" Me.txtConf.Value = "" Me.cmbCat.Value = "" Me.txtRemark.Value = "" Call Main MsgBox "Updated Successfully", vbInformation Call Me.List_box_Data End Sub
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
When I clicked the save button, excel was forced to close without any errors.
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
combo
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
EDIT: Even though I removed "Call Main" and "Call List box Data", Excel was forced closed automatically.
CODE --> VBA
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
CODE --> VBA
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
You can also set the error trapping level (VBE options, 'general' tab, error trapping frame) to 'break on all errors'.
When excel closes, check in task manager if its process remains in the memory.
combo
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
just by-pass the login form.
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
Can't see anything obvious currently ...
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
What do you mean? Is saved button working to you?
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
Yes. Or more accurately, yes if certain fields are completed in the details frame. Several of them unfortunately cause type mismatch errors if left empty
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
>Several of them unfortunately cause type mismatch errors if left empty - What do you think is the culprit?
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
However, if you leave them uncompleted some of the fields cause type mismatches.
I am not going to go through and check/verify each and every one of them for you, though, I am afraid ...
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA
But there is certain field that can be blank during encoding. hmmmmmmmmmmm...... Anyways, Thank you.
RE: Force closed or Crashed when Clicking Update/Save Button Userform Excel VBA