Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error in code, need help please 1

Status
Not open for further replies.

yoshi88

Technical User
Mar 18, 2001
48
CA
I have a code that is suppose to work. I have a country (Pays) table and an agent table, I want to change the imputmask of the zipcode (Code Postal) if the country change. I have more than 50 countries in that table so I dont want to use if then 50 times. The country tableis like this:

ID Pays Country CPmask
1 Canada >L0L 0L0;0;_
2 USA 00000-9999;0;_

In my agent form i have a ID Pays field with this code in the after update

Me.Code_Postal.InputMask = DLookup("CPmask", "Pays", "ID Pays=" & Me.ID_Pays)

Can someone tell me what is the error in this code because i got a run-time error 3075: Syntax error (missing operator) in query expression 'ID Pays=1'

Thanks

François
 
Hi,

From what I can see you do not have braces around the field ID Pays in your criteria expression: When a field name has a space in it the braces are required. It should be:

DLookup("CPmask", "Pays", "[ID Pays]=" & Me.ID_Pays)


Have a good one!
BK
 
Thanks a lot it's working really well now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top