Can you have two zip code lookups?

Hello friends. I was wondering if you can have two different zip code lookups on the same form? The first one works just fine. The second church one is the one that does not work. The fields that work are Zip, City, and State. One the second one I renamed all three fields the same except with a period at the end. When I imput the zip code on the church information expecting the City and State to be filled in. Nothing happens. Any help would be appreciated.

You should put your formula in the Formula property, not in the Code property. Then you have renamed your second Zip field to “Zip.”, so you should use that field name in your formula.

Thanks. I have tried to enter the code into the formula portion but you can not type in there. Nothing happens.

I think the problem is that your second set of fields are ending with the . character. That’s ok, but a) you have to use chevrons if the field name contains punctuation, and b) you didn’t change the Zip field in your formulas. So I think the correct code is:

«City.»=city(«Zip.»[1,5])
«State.»=state(«Zip.»[1,5])

See this help topic to learn more about using the chevrons to delimit field names:

As to the question of the Formula vs. the Code panel, either will work, but the way these panels are used is different. If you wanted to use formulas instead of code, the formulas have to go in the City. and State. fields, not the Zip. field. The City. formula would be:

city(«Zip.»[1,5])

and the State. formula would be:

state(«Zip.»[1,5])

To lean more about the difference between the Formula and Code panels, see these two help pages.

Hi Jim. I have done everything and I still can’t get it to work.

Using your new field names and following Jim’s advice, you should enter this formula in the Formula property of the “Church City” field:

city(«Church Zip»[1,5])

Thanks. I did not realize the city was case sensitive. I was using City

It’s not case sensitive. According to your screen shot, you were not using city(, you were using «Church City»(. You can’t use the name of one of your fields as a function.