N
New_Access
I think there's onething strange from below code.
The code is not work just in once click.
And in addition we have we have to move to the
next record field first so that the command can be
progressed but it means there is a blank second
record is appended.Why?Please help.
Private Sub AddSpec_cmd_Click()
On Error GoTo Err_AddSpec_cmd_Click
Dim db As Database
Dim strMessage As String
If IsNull(Me.Model) Then
strMessage = strMessage & _
" Enter Model Name" & vbCrLf
End If
If Inputvoltage.Value < 11 Then
strMessage = strMessage & _
" Input correct voltage rate " & vbCrLf
End If
If Len(strMessage) = 0 Then
Set db = CurrentDb
db.Execute "Appendix model spec_qry", dbFailOnError
CurrentDb.Execute "DELETE * FROM [Appendix model specification_tbl]", _
dbFailOnError
Else
MsgBox strMessage, vbOKOnly, "Errors Occurred"
End If
Exit_AddSpec_cmd_Click:
Exit Sub
Err_AddSpec_cmd_Click:
MsgBox Err.Description
Resume Exit_AddSpec_cmd_Click:
The code is not work just in once click.
And in addition we have we have to move to the
next record field first so that the command can be
progressed but it means there is a blank second
record is appended.Why?Please help.
Private Sub AddSpec_cmd_Click()
On Error GoTo Err_AddSpec_cmd_Click
Dim db As Database
Dim strMessage As String
If IsNull(Me.Model) Then
strMessage = strMessage & _
" Enter Model Name" & vbCrLf
End If
If Inputvoltage.Value < 11 Then
strMessage = strMessage & _
" Input correct voltage rate " & vbCrLf
End If
If Len(strMessage) = 0 Then
Set db = CurrentDb
db.Execute "Appendix model spec_qry", dbFailOnError
CurrentDb.Execute "DELETE * FROM [Appendix model specification_tbl]", _
dbFailOnError
Else
MsgBox strMessage, vbOKOnly, "Errors Occurred"
End If
Exit_AddSpec_cmd_Click:
Exit Sub
Err_AddSpec_cmd_Click:
MsgBox Err.Description
Resume Exit_AddSpec_cmd_Click: