troubleshooting Question

Filtering Database results to print a report

Avatar of dumpsterdivingdave
dumpsterdivingdave asked on
Visual Basic.NET
7 Comments1 Solution291 ViewsLast Modified:
I am having trouble filtering my database to print a report using only the wanted selections.  My current code is as follows:

e.Graphics.DrawString("End of Night Report for " + System.DateTime.Today.Date, fntHeader, Brushes.Black, sngPrintX, sngPrintY)
        sngPrintY += fntHeader.GetHeight + 25
        e.Graphics.DrawString("StarTag" + ControlChars.Tab + ControlChars.Tab + "Last Name" + ControlChars.Tab + _
            "Start Date" + ControlChars.Tab + ControlChars.Tab + "Status" + ControlChars.Tab + ControlChars.Tab + _
            "Last Agent", fntUnderline, Brushes.Black, sngPrintX, sngPrintY)
        sngPrintY += fntRegular.GetHeight + 2
        frmMain.cboStarTag.SelectedIndex = 0
        While frmMain.cboStarTag.SelectedIndex < frmMain.cboStarTag.Items.Count
            e.Graphics.DrawString(frmMain.txtStarTag.Text + ControlChars.Tab + frmMain.txtLastName.Text + ControlChars.Tab + _
                ControlChars.Tab + frmMain.dtpStartDate.Value.Date.ToString + ControlChars.Tab + frmMain.cboStatus.Text + _
                ControlChars.Tab + frmMain.txtAgent.Text, fntRegular, Brushes.Black, sngPrintX, sngPrintY)
            sngPrintY += fntRegular.GetHeight + 2
            If frmMain.cboStarTag.SelectedIndex = (frmMain.cboStarTag.Items.Count - 1) Then
                Exit Sub
            End If
            frmMain.cboStarTag.SelectedIndex += 1
        End While
        frmMain.dbaBlackhole.Fill(frmMain.dsBlackhole.Progress)
        frmMain.dbaQuery.Fill(frmMain.dsQuery.Progress)
        frmMain.dbaBlackhole.FillBy(frmMain.dsBlackhole.Progress, "Complete")
        frmMain.dbaQuery.FillBy(frmMain.dsQuery.Progress, "Complete")
        frmMain.cboStarTag.SelectedIndex = 0
        While frmMain.cboStarTag.SelectedIndex < frmMain.cboStarTag.Items.Count
            If frmMain.dtpFinishDate.Value.Day = System.DateTime.Today.Day Then
            e.Graphics.DrawString(frmMain.txtStarTag.Text + ControlChars.Tab + frmMain.txtLastName.Text + ControlChars.Tab + _
                ControlChars.Tab + frmMain.dtpStartDate.Value.Date.ToString + ControlChars.Tab + frmMain.cboStatus.Text + _
                ControlChars.Tab + frmMain.txtAgent.Text, fntRegular, Brushes.Black, sngPrintX, sngPrintY)
            sngPrintY += fntRegular.GetHeight + 2
            End If
            If frmMain.cboStarTag.SelectedIndex = (frmMain.cboStarTag.Items.Count - 1) Then
                Exit Sub
            End If
            frmMain.cboStarTag.SelectedIndex += 1
        End While

Currently, it will display the print preview, but on the document will only be those entries in the database that meet the critera where their status is "In-Repair".  What I want it to do is display all records that have a status of "In-Repair" or "Complete" if the finish date is the same as the current date.  I have tried omitting the If frmMain.dtpFinishDate.Value.Day = System.DateTime.Today.Day Then to try and get it to just display all In-Repair and Complete units, but it still only prints/shows the In-Repair units.

Any help?
ASKER CERTIFIED SOLUTION
Netminder

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros