I'm trying to create a query. The only part that is giving me trouble is the Parameter value. Even though the parameter value is defined (I think) the "enter parameter value" still pops up. I don't want that box to pop up and I want the query to show the results for "objname." Any suggestions?
Private Sub Command93_Click()
Dim objname As String
Dim db As DAO.Database
Dim MyQry As DAO.QueryDef
Dim rs As Recordset
Me.Combo7.SetFocus
objname = Me.Combo7.Text
If Me.Check90 = True Then
Set db = CurrentDb
Set MyQry = db.CreateQueryDef("TempQry", "SELECT dbo_qry_MasterPriceTable.Name, dbo_qry_MasterPriceTable.Category, " & _
"dbo_qry_MasterPriceTable.Product, dbo_qry_MasterPriceTable.ProductDesc As Description, dbo_qry_MasterPriceTable.Weight, " & _
"dbo_qry_MasterPriceTable.Price, dbo_qry_MasterPriceTable.UnitPrice, dbo_qry_MasterPriceTable.Level_Desc As [Price Level] " & _
"FROM dbo_qry_MasterPriceTable " & _
"Where dbo_qry_MasterPriceTable.name = objname " & _
"ORDER BY dbo_qry_MasterPriceTable.Num;")
'Set rs = MyQry.OpenRecordset()
DoCmd.OpenQuery "TempQry", acViewNormal, acEdit
MyQry.Parameters(0) = objname
End If
End Sub