The whole point of the subform is that it is controlled by the record source and the child and main fields of the link. Let's say a form is a company, and a subform is Employees, the source of the record for the subform can be:
SELECT EmployeeID, CompanyID, Position, Etc FROM Employees
CompanyID. , , . , , , :
SELECT EmployeeID, CompanyID, Position, Etc FROM Employees
WHERE Position = "Technical"
, , combobox, , -, :
Link Master Fields: CompanyID; cboPosition
Link Child Fields : CompanyID; Position
, :
Me.Employees_subform.Form.Filter = "Position=""Tecnical"""
Me.Employees_subform.Form.FilterOn = True
, , .
, :
SELECT EmployeeID, CompanyID, Position, Etc FROM Employees
WHERE Position = Forms!MyMainForm!cboPosition
SQL , ADO, SQL , SQL ADO .
, , .
:
DoCmd.SetParameter "@SomeID", "1"
' This works
DoCmd.OpenQuery ("Queryx")
' This will give a prompt for @SomeID and then run
Me.SomeSubform.Form.RecordSource = "Queryx"