Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Used() function returns .t., but table is not open?
Message
From
13/07/2005 18:53:08
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Network:
Windows NT
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01032327
Message ID:
01032438
Views:
21
>I have a function that usually hums along, but has recently come up with an intermittent problem. The code is very simple:
>
>if !Used('ABC')
> use abc in 0
>endif
>select abc
>.....

The used() function works with an alias name, not with the table name. Perhaps another table happens to be open with the alias "abc".

To avoid error messages, use the AGAIN clause, just in case the same table is already open, but with another alias.

Here is an example, to integrate both concepts:
CurrentMonth = "January"
if used("MonthlyData")
  select MonthlyData
else
  select 0
  use (CurrentMonth) again alias MonthlyData
endif
>
>The problem is that Used() on occasion will return .t., but when I try to select the table, I get a "table is not open" error. The same function runs fine 99% of the time, and I cannot recreate the problem at will.
>
>When it does fail, I can see that the table (or at least the alias) is not open in the current data session even though Used() returned .t.
>
>I know I have seen other posts similar to this, but they don't seem to be coming to me in a search.
>
>Can someone help?
>
>TIA,
>Margaret
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform