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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset Question?

Status
Not open for further replies.

Nightsoft

Programmer
Aug 23, 2001
50
0
0
DK
Hi there.

I'm trying to make an VB6 Application, which has a report in it...
The Report, is a custom report, where I've selected the datasource ( Same as in App ) and taken the fields from the db which I want to use.

Then I Make an Recordset, and write MyCr.Database.SetDataSource RS

This works fine, put I'm not getting the right data in the report. I know, my sql is right, because, I use the same SQL to make a form which holds the same data, as should be in the report.

The SQL Is like this.
Code:
SQL = "SELECT Sag.SagsId, Sag.Dato, Sag.Overskrift, Sag.ProblemBeskrivelse, Sag.Udfoert" & _
        ", Kunde.KundeId, Kunde.Navn, Kunde.Adresse, Kunde.PostNr, Kunde.ByNavn, Kunde.KontaktPerson, Kunde.TelefonNr, Kunde.MobilNr" & _
        ", Server.ServerNavn, Server.ServerType, Server.CPU, Server.RAM, Server.Harddisk, Server.Controller, Server.Netkort, Server.TapeDevice, Server.ServerSoft, Server.BackupSoft, Server.AntiVirusSoft, Server.FirewallSoft" & _
        ", Sup.SupportType" & _
        ", MedArb.Navne" & _
        " FROM SagsTB Sag, KundeTB Kunde, ServerTB Server, MedarbejderTB MedArb, SupportTypeTB Sup" & _
        " WHERE Sag.SagsId = " & Replace(arrId(1), " ", "") & _
        " AND Sag.KundeId = Kunde.KundeId" & _
        " AND Sag.ServerId = Server.ServerId" & _
        " AND Sag.SupportId = Sup.SupportId" & _
        " AND Sag.MedarbejderId = MedArb.MedarbejderId"

I'm exstracting a lot of data, with 4 joins, and a SagsId Which has the number of the case to be viewed..

What I can't figure out, is, if I make an Do While Not (RS.BOF Or RS.EOF)

And writing the data in a msbbox, before it is sent to crystal reports, I get the correct data.

Is there a difference in SQL Syntax?

Any help is appreciated

Thnx

Dennis

Machine code Rocks:)
 
Check the record selection formula in the report itself, and make sure that nothing is further restricting the data coming from the recordset.

Also, try adding these two lines around your call to SetDataSource:
[tt]
[tt]MyCr.DiscardSavedData[/tt]
MyCr.Database.SetDataSource RS
[tt]MyCr.ReadRecords[/tt]
[/tt]
If that doesn't work, try posting:
Crystal version
Sample data
Current output
Expected output
Database/Connectivity used when designing the report.

-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top