M
Mike Collard
I have a query with a parameter that references a form; I
need to update the underlying table on which the query is
based and have been trying to create some code to do so.
First of all I got an error 'Too few parameters. Expected
1' which is apparently caused because the query references
a form. I modified the query temporarily so that it
didn't reference the form and it worked but that is not an
acceptable solution so I have modified my code as below
but I now get an error 'Item not found in this collection'
Sub Test()
Dim dbsA As Database, rstA As Recordset, qdfA As QueryDef
Set dbsA = CurrentDb
Set qdfA = dbsA.QueryDefs("Pricing Test")
qdfA![Forms]![Pricing Screen]![Site_id] = [Forms]![Pricing
Screen]![Site_id]
Set rstA = dbsA.OpenRecordset("Pricing Test",
dbOpenDynaset)
End Sub
Any help appreciated.
Mike Collard
need to update the underlying table on which the query is
based and have been trying to create some code to do so.
First of all I got an error 'Too few parameters. Expected
1' which is apparently caused because the query references
a form. I modified the query temporarily so that it
didn't reference the form and it worked but that is not an
acceptable solution so I have modified my code as below
but I now get an error 'Item not found in this collection'
Sub Test()
Dim dbsA As Database, rstA As Recordset, qdfA As QueryDef
Set dbsA = CurrentDb
Set qdfA = dbsA.QueryDefs("Pricing Test")
qdfA![Forms]![Pricing Screen]![Site_id] = [Forms]![Pricing
Screen]![Site_id]
Set rstA = dbsA.OpenRecordset("Pricing Test",
dbOpenDynaset)
End Sub
Any help appreciated.
Mike Collard