Ok Dennis,
I will try again!
Thanks you.
Hello Dennis,
Your code works fine, but now I have add a control. Indeed, if the phone
number exists, I display a MsgBox, who says “The phone number also exists”.
And if it exists, the user goes to the Annonce_final_modif form. With the
new control, the code that you give me doesn’t work. Although I have try
everything, and I find nothing.
If you have a suggestion, let me know.
Here is my code :
Private Sub téléphone_AfterUpdate()
If (DCount("*", "requete_telephone")) > 0 Then
MsgBox ("Le numéro de téléphone que vous avez saisi existe déjà!")
Application.Echo False
DoCmd.OpenForm "TEST2"
DoCmd.FindRecord Forms!TEST1!téléphone, acEntire, , acSearchAll, ,
acAll, True
DoCmd.Close acForm, "TEST1", acSaveNo
Application.Echo True
End If
End Sub
**********************************
And here the code of my query (requete_telephone):
SELECT DISTINCT Annonce.téléphone
FROM Annonce
WHERE (((Annonce.téléphone)=[forms]![Annonce_final]![telephone]));
Thanks you!
smael smael - 28 Apr 2005 17:06 GMT
thanks you for all Denis!!!
It works perfectly fine!
Bye! :)