Please help!  Having trouble finding records when searchign two tables.

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

Hi
I finally figured this out (or at least a way of doing it that seems to work!
In VS create a new, empty datasource with no database objects in it. You'll get a message saying asking if that's what you really want to do.
Add a TableAdapter to the datasource using the 2-table SQL statement with a join but no WHERE clause, in my case:
"SELECT tblMedia., tblTitles. FROM tblMedia LEFT JOIN tblTitles ON tblMedia.ODGMediaID = tblTitles.ODGMediaID "
Make sure Fill a DataTable and Return a DataTable are checked.
Rename the TableAdapter and DataTable to something sensible.
Design the report using the new Dataset.
To display the report in VB with user generated WHERE clause:
strWhere = "WHERE ID=..." etc
strSQL = "SELECT tblMedia., tblTitles. FROM tblMedia LEFT JOIN tblTitles " & _
                        "ON tblMedia.ODGMediaID = tblTitles.ODGMediaID " & strWhere
Dim conn As OleDbConnection = New OleDbConnection(strConn)
Dim da As OleDbDataAdapter = New OleDbDataAdapter(strSQL, conn)
Dim dsReport As New DataSet
da.Fill(dsReport, "DataTableName")
Dim rpt As New ReportDocument
rpt.Load(PathToReportFile)
rpt.SetDataSource(dsReport)
crReportViewer.ReportSource = rpt
Jonathan Attree

Similar Messages

  • Please help - having trouble with blackberry curve 8520

    My fone wont let me edit or add new contacts, except if I add them to my sim card then copy them over to my blackberry. Its a new fault that I noticed last night and I'm not sure what to do?! I tried removing the battery, and replacing it but it hasn't worked!!
    Solved!
    Go to Solution.

    Please remove Yahoo! Messenger or Windows Live Messenger for the meantime until a new update has been released because one of these apps' newly updated version is causing the issue to most OS5 phones...
    Click "Accept as Solution" if your problem is solved. To give thanks, click thumbs up Blackberry Battery Saving Tips | Follow me on Twitter

  • I'm having trouble finding the HEALTH magazine app for my iPad.  The mag insists that it has a free app.  Help!!

    I'm having trouble finding the HEALTH magazine app for my iPad.  The mag insists that it has a free app.  Help!!

    What country are you in ? Is this the app : Health magazine ?

  • I would like to print a four sided programme, but am having trouble finding out how to organise the sections onto a 17  by 11 paper with the sections in the right order. Any help?

    I would like to print a four sided programme, but am having trouble finding out how to organise the sections onto a 17  by 11 paper with the sections in the right order. Any help?

    If all you are going to do is print double sided and them make
    a single fold reducing the page to 8 1/2 x 11, one side of the
    original 17 x 11 page will be page 4 on the left as you hold
    the page facing you and page 1 on the right, reverse side
    should be printed so top is same as top on the the first side
    and will be page 2 to the left and page 3 to the right. Pick
    up the double sided document with pages 2 and 3 facing you, fold
    left edge to meet right edge; you should now have fold on the left
    with page 1 facing up toward you, turn the page as you normally
    would and pages 2 & 3 should be in order, and one more turn brings
    you to page 4 and the fold should know be on the right. I hope this
    explains clearly enough - if not, post back and some one should
    join in with a better explanation.

  • I'm having trouble finding firefox sync on my desktop and to download to my ipad2 for schoolwork!

    I'm having trouble finding firefox sync on my desktop AND getting it over to my ipad2. I've been through all the support and still can't find it. Please help! I need it for my schoolwork!

        Mam129, I rely on email to stay connected with family and friends so I know how important it is to be able view them on my phone. But don’t worry because I’m here to help.
    Are you still unable to set up your email? A fix for the issue has recently been implemented. Please try setting up the email again and keep me posted if you have any issues.
    John B
    Follow us on Twitter @VZWSupport.

  • I am having trouble installing acrobat, when I run the programme it comes up with a script error

    I am having trouble installing acrobat when I run the file, it comes up with a script error

    Hi Pat
    Thanks for your email.  I was able to download and install this morning without any problems.  I uninstalled the old version yesterday and restarted my computer but still got errors.  However when I turned off last night, windows ran updates and that must of fixed the problem.  I also got rid of firefox and put of google chrome.  All to use Australia Posts click and send which wouldn't work because of an error with the plugin.  Thanks for your very quick reply, I appreciate your help.  Have a great day.  Best Regards Judy (moo2u2)

  • "Hmm we're having trouble finding that page" error message

    Hi all,
    There is a known issue where many pages are returning a "Hmm we're having trouble finding that page" 
    Our team is working on this issue right now. When we know, I will update this thread.
    Sorry for the inconvenience,
    Joe

    I've been catching up on The Office online through my xfinity streampicks subscription, but now I get an error message saying "Hmmm, we're having trouble watching that page." I just watched an episode yesterday, and the last season JUST ended at the beginning of the summer. Is it really gone from streampicks??

  • I am having troubles deselecting calanders, When i deselect a calendar, it automatically gets selected again?

    I am having troubles deselecting calanders, When i deselect a calendar, it automatically gets selected again?

    I skimmed through this very long post but from what I read, this sounds much more like a coverage issue with your network than a device issue.  I have not seen or heard of this issue before and I do not have this issue personnally and & I use the music app quite frequently while working in the yard.
    The DND feature should not be a factor at all if you're sure it's turned off.  I always recommend restarting your phone by holding down the home button + the lock button for 10-12 seconds until the Apple logo appears.  Once the phone reboots, do a test to see if this has helped to resolve the issue.
    If not, go to Settings > General > Reset > Reset Network Settings.  Then, test it out again.  Post back if neither of these solutions solve your issue.

  • Please help me to find my iPad and iPhone 5C. I lost all of them last night. I set up icloud for my devices but i can't find them because they were not connect to the Internet. Please guide me other ways to find my "best friends".

    Dear Apple,
    Please help me to find my iPad Air 2 64 GB and iPhone 5C 8GB. They're in IOS 8.0 maybe...I lost all of them last night. I set up icloud for my devices but i can't find them because they were not connect to the Internet. Please guide me other ways to find my "best friends". They're very important to me. Many important files for my job in here and it has sentimental value to me. My boyfriend gave it for me so i don't want to lose them. And because i just lost my iPad Air last 3 month, and now i just bought iPad Air 2 two months ago. I'm so sad and lost. I want to catch the thief to the police so bad because they keep my bag and many other important things. I can not do anything without them. Please help me and contact me via my email or my phone. Thank you very much. Hope to receive your answer soon.

    Hey there thaovy309,
    Welcome to Apple Support Communities.
    The linked article below provides a lot of great information and suggestions that should address your concerns about your data and finding your lost or stolen iPhone 5c and iPad Air 2.
    If your iPhone, iPad, or iPod touch is lost or stolen - Apple Support
    Take care,
    -Jason

  • PLEASE HELP ME TO FIND THE SOLUTION REGARDING "LOGICAL SYSTEM CHANGED"

    HAI EVERYBODY,
    PLEASE HELP ME TO FIND THE SOLUTION REGARDING "LOGICAL SYSTEM CHANGED" during the material master replication by using middleware parameters.
    step1 : i have taken SRM client 810 and named it as CHINNISRM
    step2 : i  have taken r3 client 810 and named it as CHINNIR3
    step3: During material master replication i maintained tables like crmconsum,crmrfcpar,crmparoltp in   r3   and smofparsfa in srm client and filtered the objects and loaded the objects through r3ac3,r3ac1,r3as.
    step4 : And later i have checked in r3 queues to activate the objects,but i have seen a message like  "LOGICAL SYSTEM CHANGED:SEE 588701".according to the oss instructions i have checked in CRMPRLS table in se16 in R3 .there i found out there is one logical client  named with T90CLNT810.
    oss :588701
    Solution
    There are different cases in which different forms of processing are
    required or where several options exist:
    - The logical system name of an R/3 Backend client was changed in
    current operation. In this case, the data hangs in the outbound
    queues of the R/3 Backend system as specified under point 1 of
    the symptom. In this case, the logical system name must be
    changed back to the original value. Then the outbound queues
    can be reactivated. If no data was transferred to the EBP/CRM
    server before the change, also a correctioin of the check table
    is possible.
    - The same logical system name was used again in a new client of
    an R/3 Backend system that was linked to the EBP/CRM server. In
    this case, the data is in the inbound queue of the EBP/CRM
    server with the exception GUID_FOR_LOGSYS_CHANGED. In this
    case, the queue entries which have status SYSFAIL must be rejected, however, not the entire queues. If the new client of  the R/3 Backend system you have linked has exactly the same
    data as the old client and if it is meant to replace the old
    client (that is, this was deactivated), also a correction of
    the check tables is possible. In this case, the inbound queues
    can be reactivated after the correction.
    oss:765018
    1. If the situation in your system corresponds to the situation described
    under "Reason and Prerequisites" and if symptom 1 occurs, you can
    delete the table entry from table CRMPRLS table (there is just one
    entry). Since there is no maintenance dialog for this table and you
    cannot maintain it using transaction SE16, you must use a report to
    delete it. This report is attached to this note as correction
    instructions.
    Create the report ZZ_DELETE_CRMPRLS in your system and copy the source
    code from the correction instructions. You cannot implement this
    source code using transaction SNOTE.
    You can use the report in every plug-in or plug-in basis system, even
    if it is not specified in the validity section.
    After you have run the report, you can trigger existing queues again
    in transaction SMQ1.
    2. If the situation in your system corresponds to the situation described
    under "Reason and prerequisite" and if symptom 2 occurs, you can
    delete the entry from table CRMMLSGUID (there is just one entry).
    Since there is no maintenance entry for this table and you cannot
    maintain it using transaction SE16, you must use a report to delete
    it. This report is attached to this note as correction instructions.
    If they do not yet exist, add the following messages to message class SMOF in your logon language:
    Message Message short text
    303 User &1 is not allowed to change table &2.
    304 User &1 IS not allowed to display table &2.
    305 Logical system &1 was not found in table &2.
    306 System error! The current client was not
    found in table T000.
    Create the report ZZ_DELETE_CRMMLSGUID in your system and copy the
    source code from the correction instructions. You cannot implement
    this source code using transaction SNOTE.
    You can use the report for every release of the CRM system, even if it
    is not specified in the validity section. The only exceptions are CRM
    releases with Support Package versions that are too low such as CRM
    Release 3.0 with Support Package 12.
    After you have run the report, you can trigger existing queues again
    in transaction SMQ1 of the R/3 back-end system or transaction SMQ2 of
    the CRM system.
    so what should i do to do the replication.please suggest me .untill and unless i solve my problem i cant move to the further activity.i hope you people can solve my problem.thanks in advance.
    thanks and best regards,
    n.chakradhar

    Hi chakradhar,
    Did you find a solution to your issue? We are facing a similar issue and looking to figure out how this can be resolved.
    BR// 420

  • Need driver for canon mg 5250 as scanner is not working with version 10.7. Can you please help me to find the driver so scanner works with WIFI?

    need driver for canon mg 5250 as scanner is not working with version 10.7. Lion. Can you please help me to find the driver so scanner works with WIFI?

    Try with the latest Apple driver package for Canon (released 15th Feb):
    http://support.apple.com/kb/DL899
    This solved my problem with the printing.

  • HT1937 I would like to help me. My iPhone was lost and stolen and I didn't have configured Find My iPhone. So I could n't find it. Please help me to find it or delete my information and photos. This is my serial No: DN*****TWD. Thank U

    I would like to help me. My iPhone was lost and stolen and I didn't have configured Find My iPhone. So I could n't find it. Please help me to find it or delete my information and photos. This is my serial No: DN*****TWD.  
    <Personal Information Edited by Host>

    If you didn't set up Find My iPhone, there's nothing we can do to help you. Sorry.

  • I want a soundbar for my 6th generation nano but am having trouble finding a compatible device. I'd like more than a dock, ideally a soundbar with wireless subwoofer. I'll only use the soundbar for music, not TV home theater. Any suggestions?

    I want a soundbar for my 6th generation nano but am having trouble finding a compatible device. I'd like more than a dock, ideally a soundbar with wireless subwoofer. I'll only use the soundbar for music, not TV home theater. Any suggestions? Thanks.

    Google

  • I need to swich from us store to saudi arabian store, please help me to find solution.

    i need to swich from us store to saudi arabian store, please help me to find solution.

    See  >  Change your iTunes Store country
    Here  >  http://support.apple.com/kb/HT1311

  • Please help me in finding link to downlaod oracle BI discover

    Please help me in finding link to downlaod oracle BI discover
    i didnot find discover in obiee so where can find
    Thanks in Advance

    Hi,
    Discoverer is part of BI Standard Edition. You can down load BI from here. You need the 2 CDs for Discoverer Plus and Viewer and the Tools CD for Discoverer Admin and Desktop.
    You should also apply the patches to go to the latest version. The LearnDiscoverer blog has details of the latest patches.
    Rod West

Maybe you are looking for