Here are two sample records, some have zips and some don't have zips
Code:
1107 N. Watson Road (1360 & Brown Blvd), SomeWhere, TX
2601 Timberline Drive, SomeWhere, TX 70000
I did instring functions to find Comma1, Comma2 comma3 and I restricted to show only records where
Code:
Where comma1>0 and Comma2>0 and comma3 = 0
This will give me the records like the one I showed in my sample "Address",City, State zip. Some have a zip and some don't but it fits the format I'm looking for. This will take care of about 90% of my records
Code:
The get the address I'm parsing a field called [EventAddr]
Left([EventAddr],[comma1]-1)
To get the city I'm using
Mid([EventAddr],[comma1]+1,[comma2]-[comma1]-1)
All of the addresses are in Texas so I'm just using TX for state
To get the zip I created an expression called Has zip to look at the last character of[EventAddr] and determine if its numeric
Code:
HasZip: IsNumeric(Right([EventAddr],1))
To get the zip I used the switch function
Code:
Switch([HasZip]=-1,Right([EventAddr],5))
I don't see why I should be getting an error. My query only looks at records where commas 1 and 2 are valid.
...I'm wondering if it could be the switch function. I've heard some bad things about that function