I have a VBA project that runs into an error:
Dim db
Dim rstOrders As Recordset
Dim rstTabOrders As Recordset
Dim strOrders As String
Set db = CurrentDb
strOrders = "SELECT SQY_ImportOrders_Basis.[Nummer inkooporder] FROM SQY_ImportOrders_Basis"
Set rstTabOrders = db.OpenRecordset("Tab_InkoopOrders", dbOpenDynaset)
Set rstOrders = db.OpenRecordset(strOrders, dbOpenDynaset)
This code hangs on the last line (Set rstOrders =...) ginving an error saying that there are too few parameters and it expects 1.
Furthermore: the strOrders query, works fine when pasted in an SQL query.
The query "SQY_ImporOrders.Basis" has a part of a field that is linked tot a form. The form is open as the code is started y a button on that form.
The reference to the form is in a part a of a query field:
I can't seem tot find where this goes wrong?