Hi Beth,
The OR in the statement causes reccount() to always be evaluated and the error is because the cursor does not exist. You either need to break up statement into two parts or check to make sure the cursor exists.
IF (VARTYPE(poGraph.cursor2) = "U" AND lnbutton = 5) ;
OR (USED(poGraph.cursor2) AND RECCOUNT(poGraph.cursor2) = 0)
>Hi All,
>
>I have a form where I show graphs. I have 3 buttons on this form. One is for collecting the data, second if for generating the report for printing, and the third is for, if there is a 2nd graph for the report (there is only one report with 2 graphs at the moment), toggling between the two graphs.
>
>In the second button, I have a IF statement, where I am trying to determine weather there is not a 2nd graph and was the 2nd graph report selected or if there is, does it have any records in it. My current statement looks like this:
>
>
>IF (VARTYPE(poGraph.cursor2) = "U" AND lnbutton = 5) ;
> OR RECCOUNT(poGraph.cursor2) = 0
>
>
>I get error 17 – table number is invalid.
>
>PoGraph is an empty class I create. In the first button code, I add properties for cursor1 and cursor2, cursor2 is set to .NULL. (it was .F. before) if the report is not the 2 graph report, otherwise it is set to the cursorname.
>
>Lnbutton holds the number of the report from the report table. 5 is the only report with 2 graphs, all the others have only one graph with them.
>
>Do I need to break this into 2 IF statements, or more, or can it be done as one?
>
>TIA
>Beth