Solved

Close table

Posted on 2015-01-06
1
234 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
error starting form builder in 11g 2 47
Access Runtime Error '3070' 5 45
Need a mirrored QA test site 2 87
Ms Access 2010 Setup (Executable file) 4 58
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…
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
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…

739 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