Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB and Crystal Report Help 1

Status
Not open for further replies.

JSUAlumni

Programmer
Mar 29, 2001
21
US
I've developed an application that uses VB 6, Crystal Reports 8, and SQL Server 7. In my application when I hit submit, the form sends the beginning and ending dates to my crystal report like so:

Dim selection As String
selection = "{Info.Date} >= #" & _
DTPicker1.Value & &quot;# AND {Info.Date} <= #&quot; & DTPicker2.Value & &quot;#&quot;
CrystalReport1.SelectionFormula = selection
CrystalReport1.ReportFileName = App.Path & &quot;\Report.rpt&quot;
CrystalReport1.Action = 1

The selection statement is getting sent fine cause the report only views the records with the appropriate dates. However, also in my application I add entries into the Info table. If I then try to view the report the entries I've added do not show up. It's as if the only records I can sort through are the ones that were in the database when I saved the crystal report and then compiled the VB project. Please help if you can. Thanks.
 
Confirm that your report doesn't have saved data, that often fools people.

If you run the report from the CR design environment can you see these records? Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
No, I have to refresh the report first. After I refresh the report data, then save the report then the VB report app shows up fine until I add another record. I have also unchecked the save report data option in the file/report properties.
 
Your answer isn't clear. When you open the report in the design environment, does it open in design or preview? If it opens in preview you have saved data that you need to turn off. Do this in 2 places.

File Options and also
File Report Options.


Try the following sequence as a test:

Add the new record
Close the app
Restart the app
run the report

Does the added record appear? Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
I'm also having the same problem of not able to get the report data refreshed after I designed the report.
If I made new entries to the database then they don't get reflected in my reports. For this I need to manually open the report and Refresh the Data every time.

I tried your suggestion of kenhamady setting the saved data to off in the 2 places.

File Options and also
File Report Options.

but I'm getting a
run time error : 20599
&quot;cannot open Sql Server&quot;

but if I try the same by setting the saved data to on in the 2 places then I'm not getting this error, but the data is not getting refreshed.

I'm struck up and unable to proceed from here, let me know if you have the solution for this
 
You need to keep the Saved data off.
The error tells you that you aren't logging the report into the server before running it.

Try LogonServer or SetLogonInfo. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
rpathy1974,

I may be able to help you now that I got mine to work. My problem was I didn't have the save data option turned off in both the file/options and the file/report options. After I did this it seems to work fine.

 
JSUAlumni,

I tried turning off the save data option in both the places. I'm now getting the error

run time error : 20599
&quot;cannot open Sql Server&quot;

I then tried logging on to the server as below but still I'm getting the same error.

CRE.LogOnServer &quot;p2sodbc.dll&quot;,&quot;A1&quot;,&quot;B1&quot;,&quot;C1&quot;,&quot;D1&quot;
CRE.Action = 1

Where A1 is my System DSN name
B1 is my database name
C1 is my user name
D1 is my password

Please let me know how to go about it.

NOTE: When i DESIGNED my report in Crystal Reports using SQL ODBC it prompted that trusted connection failed and asked for user name and password.

 
Which integration method are you using? That may not be the right command for your method.

If you don't know, see the FAQ on &quot;What info to include in your question&quot;. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top