iam getting this error iam completely stuck plzz help if u can here is my codes and there is an attach image plzzz help!!!
here is the code for saving a data:
Private Sub cmdsave_Click()
On Error GoTo errhandle 'to handle any other unforseen errors
'To validate the usser input
If txtcus.Text = "" Then
MsgBox "Please enter a CustomerID", vbCritical, "Error"
txtcus.SetFocus
Exit Sub 'That is jump to Exit sub statement'
End If
If txtnme.Text = "" Then
MsgBox "Please enter a Name", vbCritical, "Error"
txtnme.SetFocus
Exit Sub
End If
If txtsnme.Text = "" Then
MsgBox "Please enter a Surname", vbCritical, "Error"
txtsnme.SetFocus
Exit Sub
End If
If txtadd.Text = "" Then
MsgBox "Please enter an Address", vbCritical, "Error"
txtadd.SetFocus
Exit Sub
End If
If txtage.Text = "" Then
MsgBox "Please enter the Age", vbCritical, "Error"
txtage.SetFocus
Exit Sub
End If
If txtpnum.Text = "" Then
MsgBox "Please enter a Telephone number", vbCritical, "Error"
txtpnum.SetFocus
Exit Sub
End If
If operation = "ADD" Then
response = MsgBox("Save Record?", vbQuestion + vbYesNo)
If response = vbYes Then
MousePointer = vbHourglass
AdoCustomer.Recordset.MoveLast
AdoCustomer.Recordset.AddNew Array("CustomerID", "Name", "Surname", "Address", "Age", "TelephoneNumber") 'Array(txtcus.Text,txtnme.Text,txtsnme.Text,txtadd .Text,val(textage.Text),txtpnum.Text))
AdoCustomer.Refresh
MousePointer = vbDefault
MsgBox "New Record Added"
Else
MsgBox "Record Not Added"
End If
'Elself operation = "MODIFY" then
response = MsgBox("Update Record?", vbQuestion + vbYesNo)
If response = vbYes Then
MousePointer = vbHourglass
'look at record in AdoCustomer
AdoCustomer.Recordset.MoveFirst
StrSearch = "CustomerID ='" + Trim(txtcus.Text) + "'"
AdoCustomer.Recordset.Find (StrSearch)
AdoCusomer.Recordset.Update Array("CustomerID", "Name", "Surname", "Address", "Age", "TelephoneNumber") 'Array(txtcus.Text,txtnme.Text,txtsnme.Text,txtadd .Text,val(textage.Text),txtpnum.Text))
AdoCustomer.Refresh
MousePointer = vbDefault
MsgBox ("Record Updated")
Else
MsgBox ("Record Not Updated")
End If
'call re-initialise screen procedure
reinitialise_screen
Exit Sub 'Exit Sub Statement.Upon ant error program execution will jump to this point
'the errhandle will handle any other errors that may occur.
'it prevents the usual VB error messages from being displyed.
errhandle:
MousePointer = vbDefault
MsgBox Err.Description, vbCritical, "Cannot save..."
Err.Clear