Ask Your Question

Check data source if empty

asked 2020-07-17 13:53:11 +0200

gkick gravatar image


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

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-07-21 19:28:09 +0200

gkick gravatar image

updated 2020-07-21 19:31:56 +0200

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
    result=SQL.executeQuery("SELECT COUNT(""id"") FROM ""tblDummy""" )
myVar = result.getInt(1)
If myVar = 0 THEN
    msgbox ("no result to report",16,"Report not executable")
    exit sub
end if

End Sub

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-07-17 13:53:11 +0200

Seen: 25 times

Last updated: Jul 21