Hello Listers,
I seem to have a problem with some code I have written to determine if a file
exists.
In theory the code should delete the table if it exists and carry on if it
doesn't.
However it does not seem to delete the file if it finds it.
I have tried about a bazillion different versions of the code and none of
them seem to work properly.
I had initially tried to dimension BaseFile as Logical however the FileExists
command did not seem to return an actual true or false value
(Zero or non-Zero) In many cases it returned TSP_In_No_Source_Buffer to the
Print Statement.
Below is a snippet of the code that is giving me trouble.
'****************************************************************************
Dim proj_name1 as String
Dim proj_name as String
Dim proj_dir As String
Dim proj_map_dir As String
Dim BaseFile as STRING
Set Coordsys Window Frontwindow()
Register Table "C:\stisoft\tdcseis.dbf" type DBF
Open Table "c:\stisoft\tdcseis"
select * from tdcseis
where status = ".T."
into map_dir
proj_name = Rtrim$(map_dir.projdbf)
proj_dir = Rtrim$(map_dir.def_dir)+"\database\"
proj_map_dir = RTrim$(map_dir.def_dir)+"\mapping\"
set event processing off
set map redraw off
set progressbars off
'''''''''Check for Existence of File and delete it if found
'** Have also tried without any success.
'** IF FileExists(proj_map_dir) + "SP_In_No_Source_Buffer.tab"
'** Drop Table (proj_map_dir) + SP_In_No_Source_Buffer
'** End If
'**
BaseFile = FileExists(proj_map_dir) + "SP_In_No_Source_Buffer.tab"
Print "BaseFile = " + BaseFile
If Basefile = "T" Then
Drop Table(proj_map_dir) + SP_In_No_Source_Buffer
Print "Deleted Table SP_In_No_Source_Buffer"
END IF
Select * from gp_postsp
Where Julian_Date__Local_ > 2004000 and obj within (Select obj from
B_No_Sources)
into Bad_SP
IF SelectionInfo(SEL_INFO_NROWS) > 0 Then
SP_in_no_source = SelectionInfo(SEL_INFO_NROWS)
Commit Table Bad_SP as (proj_map_dir) + "SP_In_No_Source_Buffer"
Drop table Bad_SP
Open Table (proj_map_dir) + "SP_In_No_Source_Buffer"
Create Map for SP_In_No_Source_Buffer Coordsys Window Frontwindow()
Add Map Layer SP_In_No_Source_Buffer
Set Map Layer SP_In_No_Source_Buffer Editable On
Coordsys Window Frontwindow()
Distance Units "survey ft"
Distance Type Cartesian
XY Units "survey ft"
sSymbolAttr = "(73,16711680,14,""MapInfo Miscellaneous"",256,0)"
sCmd = "Set Style Symbol MakeFontSymbol" + sSymbolAttr
Run Command sCmd
Update SP_In_No_Source_Buffer
Set obj = CreatePoint(Local_Easting,Local_Northing)
Commit Table SP_In_No_Source_Buffer
Else
SP_in_no_source = 0
End If
'*****************************************************************************
*********************
Any suggestions would be greatly appreciated..
Jon Gramm