N
New_Access
Hi all,
I want to execute below code but it seems absolutely fail,
please help:
Private Sub AddSpec_cmd_Click()
On Error GoTo Err_AddSpec_cmd_Click
If IsNull(Me.Model) Then
MsgBox " Enter Model Name", vbOKOnly, "Model name empty"
End If
Model.SetFocus
If Inputvoltage.Value < 11 Then
MsgBox " Input correct voltage rate ", vbOKOnly, "Input voltage"
End If
Dim db As Database
Set db = CurrentDb
db.Execute "Appendix model spec1_qry", dbFailOnError
db.Execute "DELETE * FROM [Appendix model specification_tbl]",
dbFailOnError
Exit_AddSpec_cmd_Click:
Exit Sub
Err_AddSpec_cmd_Click:
MsgBox Err.Description
Resume Exit_AddSpec_cmd_Click:
End Sub
I want all condition must meet the criteria first
and then the execution is progressed.It seems
there will be many If..Then statement and I'm confuse
how to write a good code.
In fact,I want to add one more condition.
There are more 3 fields,if all of their values are 0,
the appending execution is fail
I want to execute below code but it seems absolutely fail,
please help:
Private Sub AddSpec_cmd_Click()
On Error GoTo Err_AddSpec_cmd_Click
If IsNull(Me.Model) Then
MsgBox " Enter Model Name", vbOKOnly, "Model name empty"
End If
Model.SetFocus
If Inputvoltage.Value < 11 Then
MsgBox " Input correct voltage rate ", vbOKOnly, "Input voltage"
End If
Dim db As Database
Set db = CurrentDb
db.Execute "Appendix model spec1_qry", dbFailOnError
db.Execute "DELETE * FROM [Appendix model specification_tbl]",
dbFailOnError
Exit_AddSpec_cmd_Click:
Exit Sub
Err_AddSpec_cmd_Click:
MsgBox Err.Description
Resume Exit_AddSpec_cmd_Click:
End Sub
I want all condition must meet the criteria first
and then the execution is progressed.It seems
there will be many If..Then statement and I'm confuse
how to write a good code.
In fact,I want to add one more condition.
There are more 3 fields,if all of their values are 0,
the appending execution is fail