I want to refresh data in crystal report from vb aplication

I want to refresh data in crystal report from vb aplication.

I am using MS Acess Database.

I had selected the option in crystal report option "refresh data on every print"

If I am giving discard saved data true from vb it gives the error.

Please guide me how to refresh the data from vb application.
prashant786Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
What error do you get?

What code are you using in VB to display the report?

mlmcc
0
prashant786Author Commented:
There is no error

Old data is displayed. and it is not refreshed.

guide me how to refresh
0
mlmccCommented:
You said
>> If I am giving discard saved data true from vb it gives the error.


I don't think it takes a value

Try using before you open the report

crRpt.DiscardSavedData

mlmcc
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

mlmccCommented:
What code are you using to display the reports?

mlmcc
0
prashant786Author Commented:
I am using ocx. Code is as below :

rep.destination=crpttowindow
b=chr$(34) &text1.text & chr$(34)
d="{aa.kap}=" &b
rep.groupselectionformula = d
rep.action=1

If I am giving discard saved data then it is givin error :

unable to connect; incorrect log on parameters

So please solve my problem
0
prashant786Author Commented:
Hellooo please answer me mlmcc

waiting for your answer
0
mlmccCommented:
Here is the code I use    


cr_Generic_Report.ReportFileName = "C:\MyApp\Myreport\Report.rpt"
cr_Generic_Report.ReplaceSelectionFormula "{MyTable.MyField} >= 90"
cr_Generic_Report.WindowState = crptMaximized
cr_Generic_Report.Destination = crptToWindow
cr_Generic_Report.WindowShowCloseBtn = True
cr_Generic_Report.WindowShowPrintSetupBtn = True
cr_Generic_Report.Action = 1

mlmcc
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.