p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

crystal_reports thread: ODBC connection problem

Message #1 by Mohammad Tariquzzaman <pol2871@a...> on Tue, 08 Oct 2002 12:09:09 -0700
Dear List,
I used the following codes. But data cann't be accessed by the Reports.
It's generating the full table report (from Stock table). But I just want 
to print
data filtering the from Text box item value.

How can I do using DAO?

Option explicit

Dim Db1 as database
Dim m_Report As New CrystalReport1
Dim adoRs As ADODB.Recordset

private sub Form_Load()
     Set Db1 = OpenDatabase(App.Path & "\STOCK.mdb")
     Dim SQL As String
     Text1.Text = "1003"

     SQL = "select * from ItemInfo where ItemCode = '" & Text1.Text & "'"

     Set adoRs = CreateObject("adodb.recordset")

     adoRs.Open SQL, "database=Stock.mdb;uid=;pwd=;dsn=stock", 
adOpenKeyset, adLockBatchOptimistic

     m_Report.Database.SetDataSource adoRs
     CRViewer1.ReportSource = m_Report
End sub

Please help. 

  Return to Index