title: Create a Report based on a value from Combo box in form
body: <p>I need help with solving a problem of forms and reports. I need to create a form with a Combo box that selects companies with a button to view A REPORT with some values on that selected company from Combo box. How can I do this? I created the combo box and when I press the preview button it displays all the companies. Any suggestions?</p>
  
  <p>Here is my VBA code: </p>
  
  <pre><code>Option Compare Database
  
  Private Sub Button_Click()
      'Forms!FormFirmKarnet.Visible = False
      DoCmd.OpenReport "FirmKarnet", acViewPreview
  End Sub
  
  Private Sub Close_Click()
      DoCmd.Close acForm, "FormFirmKarnet"
  End Sub
  
  Private Sub id_AfterUpdate()
      Forms!FormFirmKarnet!Code_company = Forms!FormFirmKarnet!id.Column(1)
  End Sub
  
  Private Sub id_LostFocus()
      Forms!FormFirmKarnet!code_company = Forms!FormFirmKarnet!id.Column(1)
  End Sub
  </code></pre>