Using MS Access 2007. I built a form that has a combo box of lists of 'actions' (cmboActions). This form also has a button to click that I want to run a query and display the results in datasheet view.
I am trying to pass the value from the cmboActions box to the query via the following method:
I am not sure how to set the parm up on the query. In the column on the query for "ActionTake n", how do I define the parameter (I currently have: [Forms]![frm_Action]![cmboActions]? I am assuming that 'qdf.Parameters (0)' relates to the first parameter found defined on the query. When I run the code I am getting the following error:
Set qdf = CurrentDb.Query Defs(qry_AssetActio nTaken_parm)"Variable not defined" on the query name
OR.... is there a better way to accomplish what I am trying to do? Trying to avoid having to build a separate query for each different value of 'ActionTaken' Any help would be appreciated.
I am trying to pass the value from the cmboActions box to the query via the following method:
Code:
Dim qdf As QueryDef Dim rst As Recordset Set qdf = CurrentDb.QueryDefs(qry_ActionTaken_parm) qdf.Parameters(0) = cmboActions.value Set rst = qdf.OpenRecordset DoCmd.OpenQuery [B]"qry_ActionTaken_parm"[/B] rst.Close qdf.Close Set rst = Nothing Set qdf = Nothing
Set qdf = CurrentDb.Query Defs(qry_AssetActio nTaken_parm)"Variable not defined" on the query name
OR.... is there a better way to accomplish what I am trying to do? Trying to avoid having to build a separate query for each different value of 'ActionTaken' Any help would be appreciated.
Comment