Match a vlue with table field

  • Thread starter Thread starter Wasim Yasin via AccessMonster.com
  • Start date Start date
W

Wasim Yasin via AccessMonster.com

I have a table name 'MasterTable'. when a user inputs data in a field on
the form , at this stage i want the values be entered first match with
master table field. If matched then proceed on next field otherwise display
amessage.For this purpose I need code of event procedure.
 
If i understood you then on the before update of your field you shoul enter
he code

if isnull(dlookup("FieldName", "MainTable","MyFieldInTable="
Me.fieldinform") then
msgbox "NotFound"
cancel=true
endif
 
I entered the same code but there is a run time error. my details of query
is as follow:

master table name : Nil-Master
master table field name : Customer

Form name: Nil-Question
Form field name: Customer

Now please provide a true or error free syntax. I'll be very thankful to u.
God bless u.
 
try

'if the field Customer type is string
if isnull(dlookup("Customer", "[Nil-Master]","Customer='" & Me.Customer &
"'") then
msgbox "NotFound"
cancel=true
endif

'if the field Customer type is Number
if isnull(dlookup("Customer", "[Nil-Master]","Customer=" & Me.Customer) then
msgbox "NotFound"
cancel=true
endif
 
the field type is string. I tried for string code but still there is a run
time error 3464.
 
My email address is
(e-mail address removed)
(e-mail address removed)
thanks
 
I ment post your code here, but if you want and your mdb is small, then you
can email it to
(e-mail address removed)
 
Back
Top