Sub ShowTasks() Dim RowSetObj, SQLStatement As Object DBContext=createUnoService("com.sun.star.sdb.DatabaseContext") DataSource=DBContext.getByName("TaskDB") ConnectToDB=DataSource.GetConnection ("","") exitOK=com.sun.star.ui.dialogs.ExecutableDialogResults.OK DialogLibraries.LoadLibrary("Standard") Library=DialogLibraries.GetByName("Standard") TheDialog=Library.GetByName("Dialog1") ShowTasksDlg=CreateUnoDialog(TheDialog) DialogField1=ShowTasksDlg.GetControl("ListBox1") SQLQuery= "SELECT ""Task"", ""Date"", CASEWHEN( ""Date"" > CURRENT_DATE, ' ','OVERDUE' ) AS ""Status"" FROM ""tasks"" WHERE ""Done""='No' ORDER BY ""Date"" ASC" SQLStatement=ConnectToDB.createStatement RowSetObj=SQLStatement.executeQuery (SQLQuery) While RowSetObj.next ListBox1Item=RowSetObj.getString(1) & " [" & RowSetObj.getString(2) & "]" & " " & RowSetObj.getString(3) DialogField1.additem(ListBox1Item, DialogField1.ItemCount) Wend ShowTasksDlg.Execute() End Sub