Hi Bob,

Try this:

Sub CreateSubSet

Dim     oRegion As Object,
        szPath, szState As String

        szPath  = "C:\"

        Fetch First From USA
        Do Until EOT(USA)
                oRegion = USE.OBJ
                szState = USE.STATE

                Select * From CITIES
                        Where OBJ Within oRegion
                        Into CUR__SELECTED NoSelect

                Commit Table CUR__SELECTED As szPath & "CITIES" & szState & ".TAB"
                Close Table CUR__SELECTED

                Fetch Next From USA
        Loop

        Note "Proces done!"

End Sub

Peter Horsb�ll M�ller
GIS Developer
Geographical Information & IT

COWI A/S
Odensevej 95
DK-5260 Odense S
Denmark
 
Tel     +45 6311 4900
Direct  +45 6311 4908
Mob     +45 5156 1045
Fax     +45 6311 4949
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk

*****CHANGE OF ADDRESS - COWI's offices in Odense are now under the same roof*****
On December 8th. 2003, Geographical Information & IT moved from Rugaardsvej 55, 5000 
Odense C to Odensevej 95, 5260 Odense S. 
Please note our new telephone, direct and telefax numbers.



> -----Original Message-----
> From: Robert DeRubeis [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, February 19, 2004 7:39 PM
> To: MapInfo Listers
> Subject: MI-L mapbasic code to select pts within regions
> 
> 
> Hi all,
> 
> I'm trying to create an mb to do the following- 1)select all 
> points from one table that fall in a certain region in 
> another table, then 2) save them to a new table with the name 
> of the region it fell in.  
> 
> For example, if I had a point table (cities) and a region 
> table (usa), select all cities that fall within each seperate 
> state boundary.  The end result would be 50 seperate tables 
> saved as citiesAL, citiesAZ, citiesCA, etc.  Each new table 
> created would contain only city points that fell within that 
> state boundary.
> 
> I can do this in MIPro with the boundary select tool, but 
> would have to manually select inside each state, then do a 
> save copy as, give it a name, etc 50 times.
> 
> Any help is very appreciated.
> Thanks,
> Bob
> 
> 
> ---------------------------------------------------------------------
> List hosting provided by Directions Magazine | 
> www.directionsmag.com | To unsubscribe, e-mail: 
> [EMAIL PROTECTED]
> For additional commands, e-mail: 
> [EMAIL PROTECTED]
> Message number: 10531
> 
> 
> 

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 10533

Reply via email to