Solved

Close table

Posted on 2015-01-06
1
222 Views
Last Modified: 2015-01-08
Hi
We are using VFP9 and using this SQP command to open a table.
 
sIncoming_TXTFile = ALLTRIM(GETFILE("TXT",'Select Incoming Portal Text File to import into FoxPro)','TXT File'))
sIncoming_DBFFile = LEFT(sIncoming_TXTFile,LEN(sIncoming_TXTFile)-LEN('.txt')) + '.dbf'

Wondering how I can just close this table?
Thanks
0
Comment
Question by:RVL
1 Comment
 
LVL 42

Accepted Solution

by:
pcelba earned 500 total points
ID: 40533952
FoxPro can assign an alias name dependent on the current app environment state...
The best way is to open the file prior your SQL command and assign your own (and known) alias:

USE (sIncoming_DBFFile) ALIAS SomeKnownAlias IN 0
SELECT * FROM SomeKnownAlias INTO ...
USE IN SomeKnownAlias

Of course you may find the file in a loop through all open aliases:
lnCnt = AUSED(laAliases)
FOR lnI = 1 TO lnCnt
  IF UPPER(DBF(laAliases[lnI, 1])) == UPPER(sIncoming_DBFFile)
    USE IN (laAliases[lnI, 1])
  ENDIF
NEXT

Remember the fact some SQL SELECTs can also use the same DBF file for the result cursor.

Also your command
sIncoming_DBFFile = LEFT(sIncoming_TXTFile,LEN(sIncoming_TXTFile)-LEN('.txt')) + '.dbf'
can be reduced to:
sIncoming_DBFFile = ForceExt(sIncoming_TXTFile, 'DBF')
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA MS Word "Table of Contents" extractor` 4 56
ORA-04071: missing BEFORE, AFTER or INSTEAD OF keyword 2 61
form builder not starting 3 55
Exchange 2013 tmp files 3 40
APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question