| Welcome to Huynh's Collections. We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| VB6 và Crystal report | |
|---|---|
| Tweet Topic Started: Jul 20 2007, 05:05 AM (1,095 Views) | |
| Huynhnb8x | Jul 20 2007, 05:05 AM Post #1 |
|
Th1nk
![]() ![]() ![]() ![]() ![]()
|
Private Sub cmdReport_Click() 'Dim Dbs As DAO.Database 'Dim Qdf As QueryDef Dim sql As String MsgBox username Filename = username + Trim(str(Time())) Set dbs = OpenDatabase(app.Path & "\data\GDYT.mdb") sql = "SELECT * FROM dm_bacsy where id_dm_bacsy='" & FrmPrint.txtdk & "'" With dbs ' Tao 1 Query tam thoi. Set Qdf = .CreateQueryDef(Filename, sql) 'De tranh xung dot khi co >2 user cung tao bao cao, ta phai tao ten query 'theo ten user+time() nhu sau ' Cac lenh open Recordset va nap du lieu vao report. ' In xong thi ' Xoa QueryDef vua tao bang lenh sau. '.QueryDefs.Delete Qdf.Name 'Dong database End With Set CAP = New CRAXDRT.Application Set cr = CAP.OpenReport("C:\QLTD\report\Report1.rpt") If Not Rong(sql) Then cr.DiscardSavedData Set CrystalDatabase = cr.Database Set CrystalDatabaseTables = CrystalDatabase.Tables Set CrystalDatabaseTable = CrystalDatabaseTables.Item(1) CrystalDatabaseTable.Location = Filename End If Form1.Viewer10.ReportSource = cr Form1.Viewer10.ViewReport Form1.Show 'gan lai nguon so lieu cho report de tranh bao loi mat nguon so lieu 'Lenh xoa query tam thoi 'Set Dbs = OpenDatabase(App.Path & "\data\GDYT.mdb") 'Dbs.QueryDefs.Delete Filename 'Call cr.Database.SetDataSource(App.Path & "\data\GDYT.mdb") End Sub |
| Knowledge crawling | |
![]() |
|
| « Previous Topic · Tài liệu sưu tầm · Next Topic » |
| Track Topic · E-mail Topic |
9:00 AM Jul 11
|
Theme by James... of the ZBTZ and themeszetaboards.com





![]](http://z5.ifrm.com/static/1/pip_r.png)



9:00 AM Jul 11