با سلام
این کد مربوط به دکمه جستجوی پیشرفته من هست.ابتدا میخوام جستجو بوسیله ado انجام بشه بعد به کریستال رپورت فرستاده بشه . در هنگام اجرا این خطا رو میده
A Number, Currency Amount, Boolean, Date, Time, Date-Time, or String Is Expected Here
ممنون می شم اگه کسی این مشکلو حل کنه
با تشکر
اینمم کد:
کد:
Private Sub Command6_Click()
Dim strQuery As String
Dim blnS As Boolean
strQuery = "SELECT * FROM moein"
Dim crApp As New CRAXDRT.Application
Dim crRept As New CRAXDRT.Report
Dim crDBTab As CRAXDRT.DatabaseTable
If td1.Text <> "" And td2 <> "" Then
strQuery = strQuery & " WHERE tarikh>='" & td1.Text & "' AND tarikh<='" & td2.Text & "'"
blnS = True
End If
If Text1.Text <> "" Then
If blnS Then
strQuery = strQuery & " AND shahr='" & Text1.Text & "'"
Else
strQuery = strQuery & " WHERE shahr='" & Text1.Text & "'"
blnS = True
End If
End If
If Combo2.Text <> "" Then
If blnS Then
strQuery = strQuery & " AND roosta='" & Combo2.Text & "'"
Else
strQuery = strQuery & " WHERE roosta='" & Combo2.Text & "'"
blnS = True
End If
End If
If Combo3.Text <> "" Then
If blnS Then
strQuery = strQuery & " AND nz='" & Combo3.Text & "'"
Else
strQuery = strQuery & " WHERE nz='" & Combo3.Text & "'"
blnS = True
End If
End If
If Combo4.Text <> "" Then
If blnS Then
strQuery = strQuery & " AND nmz2='" & Combo4.Text & "'"
Else
strQuery = strQuery & " WHERE nmz2='" & Combo4.Text & "'"
blnS = True
End If
End If
Adodc1.RecordSource = strQuery
Adodc1.Refresh
Set crRept = crApp.OpenReport(App.Path & "\report2.Rpt")
crRept.RecordSelectionFormula = strQuery
For Each crDBTab In crRept.Database.Tables
crDBTab.ConnectionProperties.Item("data source") = App.Path & "\db.mdb; Jet OLEDB:Engine Type=4;Jet OLEDB:Database Password=123"
Next
30 frm_report.CrystalActiveXReportViewer1.ReportSourc e = crRept
40 frm_report.CrystalActiveXReportViewer1.ViewReport
crRept.DiscardSavedData
50 Set crApp = Nothing
60 Set crRept = Nothing
frm_report.Show
End Sub