datadoit.com
|
| Posted: 05/11/2004, 7:40 PM |
|
CCS2; PHP
How do I hide a record form? This doesn't work in the record form's
BeforeShow event:
global $form;
if ($form->ds->RecordsCount == 0) {
$form->Visible = False;
}
After doing some checks, it appears that the RecordsCount for the form
returns "0" every time. Pourquois?
I have no problems using this method with grids. This is a record form.
|
|
|
 |
DonB
|
| Posted: 05/11/2004, 8:22 PM |
|
Mike,
Use num_rows() instead of RecordsCount. RecordsCount works with a grid by
executing a SELECT COUNT(*) FROM table (that is, whatever is in the CountSQL
property). It does not appear to be implemented for the Record form,
presumably because it's mainly used for calculating the pages with a
Navigator control in a Grid.
if ($form->ds->num_rows() == 0 {
$form->Visible = False;
}
--
DonB
http://www.gotodon.com/ccbth
|
|
|
 |
SteveG
Posts: 56
|
| Posted: 02/03/2005, 3:30 PM |
|
Excellent tip, Don! Thanks a lot.
|
 |
 |
Michael Mikkelsen
|
| Posted: 03/23/2005, 12:48 PM |
|
The Help file needs to be updated to refect this. There is an example in the help file (similar to the one given above) that does not work.
The Help Topic is: "ds->RecordsCount Run-Time Property (PHP)"
|
|
|
 |
|