PDA

View Full Version : محدود سازی گزارش



m_haghighat
پنج شنبه 25 تیر 1388, 15:02 عصر
برای اینکه مشخصات نفر دارای کد 102 را ببینیم این کدرابا توجه به هلپ کریستال ریپورت در فرم حاوی گزارش نوشتم ولی خطایی مبنی بر عدم پیداکردن تیبل توسط موتور جت داده شد.لطفا راهنمایی بفرماییدDim Report As New CrystalReport1Dim rs As New ADODB.RecordsetPrivate Sub Form_Load()Screen.MousePointer = vbHourglassDim db As New ADODB.Recordsetrs.Open "Select * from Mohandesin where Cod=102", "Xtreme Sample Database 9"Report.Database.SetDataSource rs, 3, 1CRViewer91.ReportSource = ReportCRViewer91.ViewReportScreen.MousePointer = vbDefaultEnd Sub

HjSoft
پنج شنبه 25 تیر 1388, 16:41 عصر
سلام ، دوست عزيز من كه از كد هاي شما چيزي نفهميدم سعي كن داخل Code بزاري .
علاوه بر اينكه بياي كريستال رو به ado وصل كني ، ميتوني توسط Forumla اين كار رو انجام بدي ، مثل كد زير‌:
ublic Function pres_report(ByVal start_date As String, finish_date As String)
Dim formula As String
formula = "Your Formula"

Dim crApp As New CRAXDRT.Application
Dim Report As New CRAXDRT.Report
Dim DBTable As CRAXDRT.DatabaseTable
' Declare a ConnectionProperty object.
Dim CPProperty As CRAXDRT.ConnectionProperty
' Declare a DatabaseTable object.
Set Report = crApp.OpenReport(App.Path & "\data\pres_rpt.Rpt") 'Report File

' Get the first table in the report.
Set DBTable = Report.Database.Tables("1")

' Set the new database location and the new table name.
DBTable.SetTableLocation App.Path & "\data\db.hjdb", komite, ""

' Get the "Database Password" property from the
' ConnectionProperties collection.
Set CPProperty = DBTable.ConnectionProperties("Database Password")

' Set the database password.
CPProperty.Value = "YourPass"
' Set the report source of the viewer and view the report.
Report.RecordSelectionFormula = formula
crt.ReportSource = Report
crt.ViewReport
End Function
مقدار YourPass و Formula رو بايد جايگزين كني .
Formula = بايد از داخل كريستال فرمولشو بسازي
YourPass = پسورد بانك اطلاعاتي شما

m_haghighat
جمعه 26 تیر 1388, 00:50 صبح
اگر ممکن است یک نمونه فرمول هم التفات بفرمایید.ضمنا آیا ورژن کریستال ریپورت برای کد شما مهم است.چون من نسخه 9 آن را نصب کرده ام.

HjSoft
جمعه 26 تیر 1388, 09:27 صبح
درسته ، منم ورژن 9 رو براتون گذاشتم .
براي فرمول سازي از اين منو بايد استفاده كنيد.

Report > Select Expert > ( chose your field) > (Setting Your Field Formula) > Click Show Formula and it's your formula
اينم يك نمونه :

{bimar.name} = "110"

[Tablename].[Filedname]

m_haghighat
جمعه 26 تیر 1388, 14:30 عصر
ممنون از لطف شما. اگه بازم درست نشد دوباره می تاپیکمتون!