Results 1 to 3 of 3
  1. #1
    Join Date
    May 2008

    Unanswered: Enter Parameter Value

    While executing the query through following coding, it again asked Enter Parameter Value whereas, I have already provided the same in query

    Private Sub OKBtn_Click()
    Dim MyDatabase As Database
    Dim MyQueryDef As QueryDef
    Dim where As Variant

    Set MyDatabase = CurrentDb()

    If ObjectExists("Queries", "qryDynamic_QBF") = True Then
    MyDatabase.QueryDefs.Delete "qryDynamic_QBF"
    End If

    where = Null

    where = where & " AND (((ProductMix.[Si M])<=Me![Text0]))"

    Set MyQueryDef = MyDatabase.CreateQueryDef("qryDynamic_QBF", _
    "Select * from ProductMix " & (" where " + Mid(where, 6) & ";"))

    DoCmd.OpenQuery "qryDynamic_QBF"
    End Sub

    But when I hard quoted the value like this

    where = where & " AND (((ProductMix.[Si M])<=0.8))"

    it perfectly works.

    Can anyone suggest me how to overcome this problem.

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 14
    Do not use Me when referring to a form in a query, you must use the full reference: Forms!FormName!Text0

    Me is only valid inside a form or a report class module as a reference to this same form or report.
    Have a nice day!

  3. #3
    Join Date
    May 2008
    Thanks a lot for suggestion & solving my problem.

Posting Permissions

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