Bharat_Naik
Senior Member Members
    Offline
 Ever ready to learn and share
Posts: 1202
Location: Chicago, Illinois
Joined: Dec 16 th, 2003
|
ZipCode Formatting & Auto Filling City and State
Feb 26th, 2004 at 9:13pm
|
Print Post
|
This Code Goes in Zip on Element Exit Event. It will let you enter either 5 or 9 digits and then format it accordingly. After putting the zipCode, it will also pick up City and State from ZipCode.db which came to you with Sesame in Sample folder. Zipcode.db is very big database, just enter one lookup in the Global Code of your database, this will reduce the lookup time significantly.
IF @LEN(ZIP) <> 5 and @LEN(ZIP) <> 9 THEN { @MSGbox("ENTER PROPER ZIP CODE", "", ""); GOTO ZIP }
If @len(@num(zip)) = 9 then zip = @left (zip, 5) + "-" + @right (zip, 4)
City = @XLookup("c:\Sesame\Data\Samples\ZipCode.db", @left (zip, 5), "Zip Code", "City") State = @XLookup("c:\Sesame\Data\Samples\ZipCode.db", @left (zip, 5), "Zip Code", "State")
========== in GLOBAL CODE: var str as string str = @XLookup("c:\Sesame\Data\Samples\ZipCode.db", "Hiram", "xxxxxCity", "Zip Code")
|