Check data source if empty

Hi,

Scenario - Report is based on query, takes a bit of time to process, however I would like to show a message-box that there is nothing to print and exit the sub if the record-set is empty.
I know I can do a row count on open forms, how can one do that with a query for a report without walking the set ?
Thanks

Had the solution all along …

Sub reptest
Dim oForm as Object
	oForm = ThisComponent.Drawpage.Forms.getByName("MainForm") 
dim Connection,SQL as object
dim myVar AS INTEGER
	Connection=oForm.ActiveConnection 
	SQL=Connection.createStatement()
	result=SQL.executeQuery("SELECT COUNT(""id"") FROM ""tblDummy""" ) 
result.next
myVar = result.getInt(1)
If myVar = 0 THEN
    msgbox ("no result to report",16,"Report not executable")
    exit sub
else
    ThisDatabaseDocument.ReportDocuments.getbyname("rptInvoice").open
end if

End Sub