Results 1 to 11 of 11
  1. #1
    Join Date
    Sep 2005
    Posts
    9

    Unanswered: Enter Parameter Value

    Hi All,

    I need ur help urgently.

    I created a report from a query (in MS Access 2003). I then created a pop up form to filter the report based on the criteria selected from any combo box on the form.

    Problem is, each time I try to filter the report based on any of the parameters on my form, i get an "Enter Parameter Value" dialog box. When I do enter a parameter, the report comes up blank.

    I have used the Documenter tool to confirm that the field names I am using are valid. what else can i do? Help!!!!!!!!!!!!

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    If you run the report without passing parameters does it run ok?

    If so, could you post the code you use to open the report
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Reporting

    Attached is a sample reporting program based off of a form which has criteria which may help you out.
    Attached Files Attached Files
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    Sep 2005
    Posts
    9
    hi pootle flump,

    below is the code for the form.
    thanx



    Option Compare Database

    Private Sub Clear_Click()
    Dim intCouter As Integer
    For intCouter = 1 To 6
    Me("Filter" & intCouter) = ""
    Next
    End Sub

    Private Sub Close_Click()
    DoCmd.Close acForm, Me.Form.Name
    End Sub

    Private Sub Form_Close()
    DoCmd.Close acReport, "rptAct3-En-Sup2"
    DoCmd.Restore
    End Sub

    Private Sub Form_Open(Cancel As Integer)
    DoCmd.OpenReport "rptAct3-En-Sup2", A_PREVIEW
    DoCmd.Maximize
    End Sub

    Private Sub Set_Filter_Click()
    Dim strSQL As String, intCounter As Integer
    'Build SQL String
    For intCounter = 1 To 6
    If Me("Filter" & intCounter) <> "" Then
    strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "] " & " = " & Chr(34) & Me("Filter" & intCounter) & Chr(34) & " And "
    End If
    Next
    If strSQL <> "" Then
    'Strip Last " And "
    strSQL = Left(strSQL, (Len(strSQL) - 5))
    'Set the Filter property
    Reports![rptAct3-En-Sup2].filter = strSQL
    Reports![rptAct3-En-Sup2].FilterOn = True
    Else
    Reports![rptAct3-En-Sup2].FilterOn = False
    End If
    End Sub

  5. #5
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Haven't read yet but... if you run the report on it's own (i.e. NOT from the form but by double clicking it) does it run ok?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Ignore last post. Does the message appear when the form loads or after pressing the button?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  7. #7
    Join Date
    Sep 2005
    Posts
    9
    yes it does.

    it also runs when i open the form but when the i try to filter from the form, the the "Enter Parameter Value" comes up.

  8. #8
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Ok. Change your code to:


    Code:
      
    Private Sub Set_Filter_Click()
    Dim strSQL As String, intCounter As Integer
    'Build SQL String
    For intCounter = 1 To 6
    If Me("Filter" & intCounter) <> "" Then
    strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "] " & " = " & Chr(34) & Me("Filter" & intCounter) & Chr(34) & " And "
    End If
    Next
    If strSQL <> "" Then
    'Strip Last " And "
    strSQL = Left(strSQL, (Len(strSQL) - 5))
     
    DEBUG.PRINT strSQL
    
    'Set the Filter property
    Reports![rptAct3-En-Sup2].filter = strSQL
    Reports![rptAct3-En-Sup2].FilterOn = True
    Else
    Reports![rptAct3-En-Sup2].FilterOn = False
    End If
    End Sub
    Can youi post the result printed to the immediate window. Does the output look syntactically correct? In particualr, are there defo no typos on field names?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  9. #9
    Join Date
    Sep 2005
    Posts
    9
    Hi

    The debugger doesn't recognize the
    Reports![rptAct3-En-Sup2].filter = strSQL (highlighted in yellow)

  10. #10
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Eh? I copied and pasted your code and inserted a line lol.

    Is the report closed when it does this? The Reports collection is a collection of all open reports.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  11. #11
    Join Date
    Sep 2005
    Posts
    9

    Talking

    hi all,

    i found the solution to the "Enter Parameter Value" problem I was having, weeks ago but forgot to post the solution for everyone's benefit.

    Ready?

    I realized that I didn't enter anything in the "Tag" for all the combo boxes I had created. So each time I tried to run the query for combo boxes, no name would be found for the "Tag" hence the "Enter Parameter Value" prompt. Little mistake that cost me days of agony.

    Thanks for all you help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •