Below is the error message:
"Efficiency can't append all the records in the append query.
Efficiency set 1 field(s) to Null due to a type conversion failure,
all it didn't add 0 record(s) to the table due to jey violations, 0
record(s) due to lock violations, and 0 record(s) due to validation
rule violations.
Do you want to run the action query anyway?
To ignore the error(s) and run the query, clidk Yes."
Table Structure:
jc_id - Number (Primary key)
jc_run_dat - Date/Time
jc_shift - Number
jc_order_num - Number
jc_operation - Number
jc_part_num - Text
jc_part_desc - Text
jc_mach_code - Text
jc_emp_id - Number
jc_parts_prod - Number
jc_hrs_prod - Number
jc_set_up - Number
VBA Code:
Private Sub cmdAdd_Click()
On Error GoTo Err_cmdAdd_Click
Dim id
DoCmd.RunSQL "Insert into Job_Card(jc_id, jc_run_date, jc_shift,
jc_order_num, jc_operation, jc_mach_code, jc_part_num, jc_part_desc,
jc_emp_id, jc_parts_prod, jc_hrs_prod, jc_set_up) values ('" &
txtID.Value & "', #" & txtdate & "#, '" & txtShift.Value & "', '" &
txtOrNo.Value & "', " & lstOpNo.Value & ", '" & txtMCode.Value & "',
'" & txtPartNum.Value & "', '" & txtPartDesc.Value & "', '" &
txtEmp.Value & "', '" & Nz(txtPcsDone.Value, "") & "', '" &
Nz(txtProdHrs.Value, "") & "', '" & Nz(txtSetUp.Value, "") & "')"
id = txtID.Value
'clear all the fields, after adding it to the database
txtID.Value = id + 1 'increment the JOB CARD ID value by 1
txtEmp.Value = ""
txtdate.Value = ""
txtShift.Value = ""
txtOrNo.Value = ""
Call RmvItms
lstOpNo.Value = ""
lstMCode.Value = ""
txtPartNum.Value = ""
txtPcsDone.Value = ""
txtProdHrs.Value = ""
txtMCode.Value = ""
txtSetUp.Value = ""
txtPartDesc.Value = ""
txtEmpName.Value = ""
'Enable the Production hrs and Pieces done text box.
txtProdHrs.Enabled = True
txtPcsDone.Enabled = True
'MsgBox "Job card details has been inserted into database"
Exit_cmdAdd_Click:
Exit Sub
Err_cmdAdd_Click:
MsgBox Err.Description
Resume Exit_cmdAdd_Click
End Sub