Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to QUICKLY determine if table does not have any reco
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01413534
Message ID:
01413576
Views:
44
>>The only way you can have a performance problem with reccount() is, not with the function itself, but in opening the table - for example, if it starts with thousands of deleted records, and you have SET DELETED ON. Also, some users have reported performance problems (again, when opening tables), with certain antivirus products.
>
>Good point!

I have SET DELETED ON at the beginning of the program.... sigh.... so I had to resort to this... what do you think???

What I want to do is Enable or Disable a command button (cmdRelease) if I have at LEAST one record that is not deleted in the table poshold.... SET DELETED is ON
LOCAL llEOF, llBOF

*TMT 07/21/09 llEOF and llBOF
llEOF = .F.
llBOF = .F.

SELECT poshold
GO bottom
IF EOF()
	STORE .T. to llEOF
ENDIF 
GO TOP
IF BOF()
	STORE .T. to llBOF
ENDIF 
DO case
	*No records at all
	CASE llBOF AND llEOF
		Thisform.cmdrelease.Enabled = .F.
	*One (or more) record(s) (at least one is not deleted), period
	CASE NOT llBOF AND NOT llEOF
		Thisform.cmdrelease.Enabled = .T.
	*All records are deleted 
	CASE NOT llBOF AND llEOF
		Thisform.cmdrelease.Enabled = .F.
ENDCASE 
GO TOP IN poshold 

Thisform.Closable=.F.
I could tighten this up and just have...
DO case
	*One (or more) record(s) (at least one is not deleted), period
	CASE NOT llBOF AND NOT llEOF
		Thisform.cmdrelease.Enabled = .T.
ENDCASE 
since that was the only condition that made the cmdRelease Enable to be True... (that we have at least ONE record that is not deleted).

Tommy
Tommy Tillman A+ NetWork+ MCP
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform