title: Using Crystal Reports in VB.net windows app
body: <p>I've done much googling and tested various code no avail, so before anyone cries "DUPLICATE" please read the question through.</p>
  
  <p><em>The Scenario:</em>  I have a windows form written in <strong>VB.net using visual studio 2013</strong>.  I have installed the Crystal Reports API, and I've opened an existing report which was provided with Sage Business Vision and removed all the fields (basically stripped it down to just the layout).  I need to pull data from 3 different tables in my pervasive database to use in this report.</p>
  
  <p><em>What I've accomplished:</em> So far, I've created a form and named it 'RPTviewer' and I've dropped the Crystal Report Viewer on it (and left the default name 'CrystalReportViewer1'</p>
  
  <p><em>The Struggle:</em>  I'm having difficulty getting the report to display much of anything.  I've tried using the SQL expression fields, but they won't let me use the WHERE clause.  It seems I can only specify PART of a SQL string between the 'SELECT' and 'FROM' clauses.<a href="https://i.stack.imgur.com/FatGn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FatGn.jpg" alt="enter image description here"></a></p>
  
  <p>My work around for this was to just do all the querying in the windows form and inject the information into predefined fields.  I've tried this using an 'Unbound Field':</p>
  
  <pre><code>Private Sub RPTviewer_Load(sender As Object, e As EventArgs) Handles MyBase.Load
      Dim rpt As New OfficeCopyPS
  
      Dim crOrderNumber As CrystalDecisions.CrystalReports.Engine.TextObject
      crOrderNumber = rpt.ReportDefinition.ReportObjects("OrderNumber")
      crOrderNumber.Text = "1234567"
  
  
      CrystalReportViewer1.ReportSource = rpt
      CrystalReportViewer1.Refresh()
      rpt.Load()
  
  
  
  End Sub
  </code></pre>
  
  <p>however, all that gets me at run time is a blank viewer.  I've also tried using a Parameter Field, but it just prompts me for a value at run time and ignores what I specified in the form_load event (it does load the report though).</p>
  
  <pre><code>        rpt.SetParameterValue("OrderNumber", "1234567")
      CrystalReportViewer1.ReportSource = rpt
      CrystalReportViewer1.Refresh()
      rpt.Load()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/g7Tx6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/g7Tx6.jpg" alt="enter image description here"></a></p>
  
  <p>There has to be a way to do this.  Is there any documentation?  Can anyone suggest a better way to get the information I need into the report?  Thanks.</p>