home *** CD-ROM | disk | FTP | other *** search
- *****************************************************************
- FUNCTION CHKSTATE (statecode)
- *****************************************************************
-
- * Verifies a two character state code
-
- * Copyright(c) 1991 -- James Occhiogrosso
-
- LOCAL old_area := 0
-
- * If passed state code exceeds 2 characters, take no action
- IF LEN(TRIM(statecode)) > 2
- RETURN(.T.)
- ENDIF
-
- * Save old work area
- old_area = SELECT()
-
- * Make sure Zip Codes database is available
- SELECT zips
- IF EMPTY(ALIAS())
- IF FILE('zips.dbf')
- * If zips file exists, open it
- SELECT 0
- USE zips
- ELSE
- * Otherwise, return with no action
- RETURN(.T.)
- ENDIF
- ENDIF
-
- * Check zips database for the state code
- statecode = UPPER(statecode)
- LOCATE FOR TRIM(statecode) $ zips->state
- IF FOUND()
- AEDMSG('mw_pgdn')
- SELECT(old_area)
- RETURN(.T.)
- ELSE
- ERRORBEEP()
- AEDMSG('Invalid State - Please reenter')
- SELECT(old_area)
- RETURN(.F.)
- ENDIF
-
-
-