Keep getting "Enter Parameter Value" when running a new report filter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anoble1
    New Member
    • Jul 2008
    • 246

    Keep getting "Enter Parameter Value" when running a new report filter

    I am trying to limit my report by a combo-box filter on a main report screen.

    Says: "Enter Parameter Value"
    then has my value I actually chose in the search below. Then a white blank. If I type in what i filtered manually it works. If I leave it blank it does not work.

    Here is some of the code I have for this particular box. When I "View the Report"
    Code:
    Dim Category As String
    Forms!frmReports!cmdCategory.SetFocus
    Category = Forms!frmReports!cmdCategory.Value
    If Category <> "" Then
        whereCond = "Category = " & Forms!frmReports!cmdCategory.Value
    End If
    DoCmd.OpenReport "rptFitNotesSummary", acViewPreview, , whereCond
    If I scroll my mouse over the "whereCond = "Category =...." It has my filter in there. Suggestions? I am missing something.
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    #2
    Somewhere there is a field name typed incorrectly. If you open the report without the WhereCondition, does it open without the "Enter Parameter Value" message? If so, then the problem is with your whereCond variable value. By the way, I see you Dim Category, but not whereCond and you set the Category variable, but then don't use it to build your whereCond varible.

    Comment

    • anoble1
      New Member
      • Jul 2008
      • 246

      #3
      I went around the issue and went in the Report VBA and created some code.

      Code:
      Private Sub Report_Open(Cancel As Integer)
      Dim Exercise As String
      Dim Category As String
      Dim Weight As String
      
      Forms!frmReports!cmdCategory.SetFocus
      Category = Forms!frmReports!cmdCategory.Value
      
      If Category <> "" Then
          Me.RecordSource = "SELECT tblFitNotes.FitID, tblFitNotes.Date, tblFitNotes.Exercise, tblFitNotes.Category, tblFitNotes.Weight, tblFitNotes.Reps, tblFitNotes.Distance, tblFitNotes.DistanceUnit, tblFitNotes.Time FROM tblFitNotes WHERE (((tblFitNotes.Category)=[Forms]![frmReports]![cmdCategory].[Value]));"
      Else
      Category = Forms!frmReports!cmdCategory.Value
      End If

      Comment

      Working...