New topic: Using report in REALbasic
<http://forums.realsoftware.com/viewtopic.php?t=30658> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message jun Post subject: Using report in REALbasicPosted: Sun Oct 25, 2009 11:00 pm Joined: Thu Jul 02, 2009 9:55 pm Posts: 25 Dear everyone, can anybody give me some example to create report connected to database with REALbasic? I still confuse with the example that given by REALbasic. Thanks to everyone. Top raymond95 Post subject: Re: Using report in REALbasicPosted: Mon Oct 26, 2009 3:59 am Joined: Sun Jul 19, 2009 12:16 pm Posts: 11 Jun, I use the following code (from the RB example) I created a blank project with a push button, the action code is: Dim ps As New PrinterSetup dim sql as string Dim rpt As Report dim rs as recordSet sql = "SELECT * FROM users" // users is your database rpt = New Report1 'set the report project item we are going to use to print the report // Now we select the records from the database and add them to the list. rs = app.esaforecastsDB.sqlSelect( sql ) 'select the records using the sqlquery chosen above if rs = nil then beep MsgBox "No records found to print." else 'set the resolution to 300 DPI for printing ps.MaxHorizontalResolution = 300 ps.MaxVerticalResolution = 300 If ps.PageSetupDialog Then dim g as graphics g = OpenPrinterDialog(ps, nil) if g <> nil then dim rsq as new Reports.RecordSetQuery(rs) 'Put the records found into a Reports.DataSet If rpt.Run( rsq, ps ) Then 'if the report runs successfully rpt.Document.Print(g) End If end if end if end if you just need to create your report form with the fields you want to print in the body section I hope this will help Ray Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 2 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
