Solved

Close table

Posted on 2015-01-06
1
204 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 41

Accepted Solution

by:
pcelba earned 500 total points
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now