xeshu
September 15th, 2004, 05:47 AM
can any one plz tell me wht is wrong with this code?
mix is the report name, that is, mix.rpt
mymain is the form in which the crystal report viewer control is placed!
and this code has been writen in another form in the button click event.
Dim myapp As New myMain
Dim myrpt As New mix
Dim tbcurrent As Table
Dim logoninfo As New TableLogOnInfo
Dim logoninfos As New TableLogOnInfos
For Each tbcurrent In myrpt.Database.Tables
logoninfo = tbcurrent.LogOnInfo
tbcurrent.ApplyLogOnInfo(logoninfo)
Next tbcurrent
logoninfos.Add(logoninfo)
myapp.cvwMain.LogOnInfo = logoninfos
myapp.cvwMain.ReportSource = Application.StartupPath & ".\mix.rpt"
'myapp.cvwMain.SelectionFormula = "{PROBLEM.P_ID}='PB100'"
'myapp.cvwMain.ReportSource = myrpt
simply i want to use the selection formula to give me the report according to the P_ID, but nothing seem to happen.
mix is the report name, that is, mix.rpt
mymain is the form in which the crystal report viewer control is placed!
and this code has been writen in another form in the button click event.
Dim myapp As New myMain
Dim myrpt As New mix
Dim tbcurrent As Table
Dim logoninfo As New TableLogOnInfo
Dim logoninfos As New TableLogOnInfos
For Each tbcurrent In myrpt.Database.Tables
logoninfo = tbcurrent.LogOnInfo
tbcurrent.ApplyLogOnInfo(logoninfo)
Next tbcurrent
logoninfos.Add(logoninfo)
myapp.cvwMain.LogOnInfo = logoninfos
myapp.cvwMain.ReportSource = Application.StartupPath & ".\mix.rpt"
'myapp.cvwMain.SelectionFormula = "{PROBLEM.P_ID}='PB100'"
'myapp.cvwMain.ReportSource = myrpt
simply i want to use the selection formula to give me the report according to the P_ID, but nothing seem to happen.