Hi All,
Learning the Access VBA ropes here.
Goal: Pass parameter into SQL Query. This is to pass a primary key into a premade query, but I don't know the primary key until the user chooses a specific record. So, I want the next form's subform (query) to display the many records to the one primary key.
VBA Methodology Being Implemented: I'm using the Current.Db.QueryDefs(Query_Name) to pass the parameter.
The error is occurring on the "Set qdF = CurrentDb..." line.
Error Message:
Below is the code: Run-time error '3421', Data type conversion error
Misc Info that might help: The subform name for the query has a space in it. Not sure if this matters, I tried to put quotes and stuff around the name of the query.
Can someone provide guidance? I feel like I'm very close...but still soooo far awaaaay.Code:Dim qdF As QueryDef Dim rsT As Recordset Application.Echo False Set qdF = CurrentDb.QueryDefs(qry_Amend_subform) qdF.Parameters("WBSIdd") = WBSIdd WBSIdd = WBSIdd Set rsT = qdF.OpenRecordset rsT.Close qdF.Close Set rsT = Nothing Set qdF = Nothing Application.Echo True
Tanks!