checking if data exist (1 Viewer)

basilyos

Registered User.
Local time
Yesterday, 23:06
Joined
Jan 13, 2014
Messages
252
i want to check if data entered in a form field is existed

the form is bounded to a table

i used this code

Code:
If DLookup("Telegram_Number", "tbl_Violation_Of_Building", "Telegram_Number Like " & Forms!frm_Add_Violation_Building!Telegram_Number) Then
MsgBox ("number existed")
Me.Telegram_Number = ""
Else
End If

everything is ok but if the data is existed the database show the message and clear the field but i'm getting a Run-time error

'-2147352567(80020009)': the macro or function set to the beforeupdate or validationRule property for this field is preventing [ISF] from saving the data in the field

i guess the problem because the form is bounded to a table so he will save automatically

my solution is to unbound the fields and save the data via vba

but is there any solution with a bounded form???
 

mh123

Registered User.
Local time
Today, 07:06
Joined
Feb 26, 2014
Messages
64
do you have a validation rule on the telegram_number field? You are setting it to "", try setting it to null
 

basilyos

Registered User.
Local time
Yesterday, 23:06
Joined
Jan 13, 2014
Messages
252
i tried it's the same result

i work on my solution thanks anyway
 

smig

Registered User.
Local time
Today, 09:06
Joined
Nov 25, 2009
Messages
2,209
If telegram_number is set as number it cant have an empty string "".
Try seting it to 0
 

Users who are viewing this thread

Top Bottom