woow
04-13-2004, 12:42 PM
This is the problem I am having.
Before the my prog throws the error saying user is trying to enter that same data as in the database. The Errhandler throws an error saying
"Unique Constrain Vilolation."
So what i want is to throw my message saying there is similar entry please enter a different one.
I don't want the Error Handler to throw it because Errorhadler is there to throw an error when other errors such as database failur or something.
any help regarding this.
Private Sub cmdSave_Click()
On Error GoTo Errhandler
intTmpMsg = MsgBox("Do you want to Save the Changes? ", vbYesNo, "Save")
If intTmpMsg = 6 Then
Do While Not rs.EOF
If Trim(txtMLI.text) = Trim(rs("mli").Value & "") Then
MsgBox ("The Entered value Exists. Please Enter a New value")
Exit Sub
End If
rs.MoveNext
Loop
rs.AddNew
rs!mli = txtMLI.text
rs!MLIDESC = txtDiscrip.text
rs.Update
If Not rs.EOF Then rs.MoveFirst
Do While Not rs.EOF
frmMLI.cmbMLI.AddItem rs!mli
rs.MoveNext
Loop
frmMLI.cmbMLI.ListIndex = 0
frmMLI.cmbMLI.SetFocus
'txtDiscrip.text = ""
'txtMLI.text = ""
Unload Me
End If
Exit Sub
Errhandler: MsgBox Err.Description
Exit Sub
End Sub
Before the my prog throws the error saying user is trying to enter that same data as in the database. The Errhandler throws an error saying
"Unique Constrain Vilolation."
So what i want is to throw my message saying there is similar entry please enter a different one.
I don't want the Error Handler to throw it because Errorhadler is there to throw an error when other errors such as database failur or something.
any help regarding this.
Private Sub cmdSave_Click()
On Error GoTo Errhandler
intTmpMsg = MsgBox("Do you want to Save the Changes? ", vbYesNo, "Save")
If intTmpMsg = 6 Then
Do While Not rs.EOF
If Trim(txtMLI.text) = Trim(rs("mli").Value & "") Then
MsgBox ("The Entered value Exists. Please Enter a New value")
Exit Sub
End If
rs.MoveNext
Loop
rs.AddNew
rs!mli = txtMLI.text
rs!MLIDESC = txtDiscrip.text
rs.Update
If Not rs.EOF Then rs.MoveFirst
Do While Not rs.EOF
frmMLI.cmbMLI.AddItem rs!mli
rs.MoveNext
Loop
frmMLI.cmbMLI.ListIndex = 0
frmMLI.cmbMLI.SetFocus
'txtDiscrip.text = ""
'txtMLI.text = ""
Unload Me
End If
Exit Sub
Errhandler: MsgBox Err.Description
Exit Sub
End Sub