I have parameterized query that is to be the recordsource for a particular form.
The form is opened, and the query is executed, when a command button is clicked. ON the "on Click' command, I have the the following code -- passing the required parameter as the OpenArgs :
On the forms On_Open property, I have the following:
The form is opened, and the query is executed, when a command button is clicked. ON the "on Click' command, I have the the following code -- passing the required parameter as the OpenArgs :
Code:
iWorkUnitID = 1
stDocName = "yfrmFishPriorities"
DoCmd.OpenForm stDocName, , , , , , iWorkUnitID
Code:
Private Sub Form_Open(Cancel As Integer)
Set Me.Recordset = FishPriority(OpenArgs)
End Sub
Function FishPriority(iWorkUnitID As Integer) As Recordset
Dim qd As QueryDef
Dim dbsCurrent As Database
Set dbsCurrent = CurrentDb()
Set qd = dbsCurrent.QueryDefs("zqryPriorScore")
qd.Parameters("Workunit") = iWorkUnitID
Set FishPriority = qd.OpenRecordset
End Function
The parameter is passed, but the query is not run (apparently) an not set as the recordsource for the newly opened form.
Any ideas?
All help is appreciated.
DJ