Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to check if the grid is empty?
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
How to check if the grid is empty?
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01536199
Message ID:
01536199
Views:
182
Hi everybody,

I have the following code in the grid's ValidateCurrentRow method:
if thisform.CancelValidation() OR RECCOUNT('rsHolds') = 0
   return
endif
local lnActiveColumn, loControl, loColumn
lnActiveColumn = this.activecolumn
if  m.lnActiveColumn> 0
   for each loColumn in this.columns
      if loColumn.columnorder = m.lnActiveColumn

         for each loControl in loColumn.controls foxobject

            if pemstatus(loControl, 'value',5)
               loControl.value = loControl.value
            else
               if pemstatus(loControl, 'valid',5)
                  loControl.valid()
               endif
            endif
         next             
         exit
       endif    
      next
endif

if empty(rsHolds.LevelID)
   =messagebox('Please select Level',48,'Validation Error')
   return .f.
endif
if empty(rsHolds.SectionID)
   =messagebox('Please select Section',48,'Validation Error')
   return .f.
endif
if empty(rsHolds.row)
   =messagebox('Please select Row',48,'Validation Error')
   return .f.
endif
if empty(rsHolds.SeatEnd)
   =messagebox('Please specify Seat End',48,'Validation Error')
   return .f.
endif
if empty(nvl(rsHolds.HoldExpire,{}))
   =messagebox('Please specify expiration date',48,'Validation Error')
   return .f.
endif
if empty(rsHolds.descrip)
   =messagebox('Please provide Hold Description',48,'Validation Error')
   return .f.
endif

this.parent.cmdDuplicate.refresh()
The problem is the following:
I add a record, then delete it. Then I click on the empty grid and then I try to click on the 'Add Hold' button I get the error message 'Please select Level' and I can not proceed.

I added reccount check after I first found this problem. It works, but this particular scenario is not working. I'm wondering what would be the simplest fix to apply?

Thanks in advance.

UPDATE. Added a select count check with buffering to ovecome this problem.
If it's not broken, fix it until it is.


My Blog
Reply
Map
View

Click here to load this message in the networking platform