Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Need assistance searching records from multiple tables - Please Help!

Hi, I've been trying to solve this problem for several weeks now, and I have exhausted all of my knowledge and experience. I need help, and I hope someone here can give me some direction.

I am using VB 2008, and the CR that comes bundled with VS 2008 Pro. My database is a SQL Server 2005 CE v3.5 (a *.sdf file). I am connecting to the database through a dataset, and I am displaying the report in a CrystalReportViewer.

My dataset consistes of two tables:

1) tblCustomers which has a primary key "CustID", and contains only customer contact and personal information.

2) tblDateVisited which has a primary key of "VisitID", but it also has a column titled "CustID". Basically, every time a customer visits the business, details of that visit are recorded in tblDateVisited, and that record is associated with the customer by their CustID.

Here's what I'm trying to accomplish: I want to be able to display only Customer records when the customer has visited and that visit matches certain criteria. Right now, I am trying to match visits from the "tblVisitDate.PlayerType" column. If the customer has ever had a visit where they matched a particular player type, I want to see those customer records.

I don't know what I'm doing wrong, though. I can search a dataset if I am only querying one table and pulling records from that table. However, whenever I try to add a second table and perform queries on that table to get records from the first table, I can't return any records.

If it helps, I am trying to use one CrystalReportViewer to display multiple reports (user choice) and here's how I'm loading the report into the viewer:

Me.tblCustomersTableAdapter.Fill(Me.dsPlayerTypeReports.tblCustomers)

Me.tblDateVisitedTableAdapter.Fill(Me.dsPlayerTypeReports.tblDateVisited)

Me.ReportFile.SetDataSource(dsPlayerTypeReports.Tables(1))

I am suspicious that my problem is in the Tables(1) method. It confuses me that I can only assign one table as a datasource when I obviously need access to two tables to make this selection work.

Whatever the case, I'm at the end of my rope with this one. I'm not prone to giving up, but I'm at a dead end currently.

Any attempt to assist me with this will be greatly appreciated, successful or not.

Thanks in advance!

-Will

Not what you were looking for? View more on this topic or Ask a question