Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ilya Rabyy
  Where is Ilya Rabyy?
 Fountain Valley
 California - United States
 Ilya Rabyy
 To: alan shulman
  Where is alan shulman?
 utica
 New York - United States
 alan shulman
 Tags
Subject: RE: Closing table issue in form
Thread ID: 289145 Message ID: 289160 # Views: 30 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Forms
Date: Tuesday, December 28, 2010 8:16:16 PM         
   


> >
> > This part would throw an error if the table is already open, see also the Again clause and Used() in help.
> >
> >
> > "Use In 0" does not close the alias you previously opened (but rather does nothing).
> > You can "Use In int" in your case, or, since that alias is the currently selected one, just "Use".
> >
> >
> >
> > Aside from the "int" alias probably having been left open by the first part of your code, the second part is unreliable anyway because it does not check what the currently selected work-area is.
> > The best option is to use the Alias or In clauses/parameters of almost every relevant Vfp command / function:
> >
> >
If Not Seek( m.y, 'yourAlias', 'yourIndexTagName' )
> >    && 
> > Endif
> > 

> >
> > hth
> > -Stefan
>
> Ok, so I need to establish a workarea and alias for the table I'm seeking? Like, in my init for the main form I would say something like "use 'valanntable' IN 1 INDEX 'valanntable' ALIAS val", then "if not seek(m.y, 'val', 'valanntable)"?
>
> Also, I thought the "use in 0" would close the 'int' table because I did not name the table. How would I close that table otherwise? Do I want to say 'close tables'?

some other things I'd like to add, colleague Alan:

1. To ensure you aren't trying to open already opened table, or re-open it if it's been already opened, issue something like

USE (lcPath2MyTable) IN (SELECT(USED(lcMyTableAlias))) ORDER (lcMyTag)

2. I'd shan giving an alias name that might possibly be a "verbotten" word, and "INT" happens to be the one: it's the name of the VFP's built-in function INT() - check the VFP's Help. (Didn't it turn blue when you typed it in your code editor? That should've been an indication for you, shouldn't it?)

3. If you know exactly the alias name for the open table that you want to close, then

USE IN (lcMyTableAlias)

would be quite sufficient.

HTH.

Regards,

Ilya

ENTIRE THREAD

Closing table issue in form Posted by alan shulman @ 12/28/2010 5:49:38 PM
RE: Closing table issue in form Posted by Stefan Wuebbe @ 12/28/2010 6:31:21 PM
RE: Closing table issue in form Posted by alan shulman @ 12/28/2010 7:49:22 PM
RE: Closing table issue in form Posted by Stefan Wuebbe @ 12/28/2010 8:07:25 PM
RE: Closing table issue in form Posted by alan shulman @ 12/28/2010 8:34:32 PM
RE: Closing table issue in form Posted by Ilya Rabyy @ 12/28/2010 10:28:10 PM
RE: Closing table issue in form Posted by Stefan Wuebbe @ 12/29/2010 1:46:25 PM
RE: Closing table issue in form Posted by Ilya Rabyy @ 12/28/2010 8:16:16 PM