Gasman
Enthusiastic Amateur
- Local time
- Today, 18:04
- Joined
- Sep 21, 2011
- Messages
- 16,758
you can't execute a query string which has parameters in it - even if they are in a referenced query. Although I've not tried it, referring back to the start of this thread, you could try predeclaring the parameters in the query and then assigning it a value through the querydef. might work.
Other way is to bring the sql of the query into your executed sql.
e.g. simple exmaple
query1:
SELECT * FROM myTable WHERE ID=forms!myform!ID
then you want an executeable sql string
currentdb.execute "select * FROM query1 inner join table2 on query1.fielda=table1.fielda"
won't work because of the parameter. But this will
currentdb.execute "select * FROM (SELECT * FROM myTable WHERE ID=" & forms!myform!ID & ") AS query1 inner join table2 on query1.fielda=table1.fielda"
CJ,
I think you have hit the nail on the head there.
That would appear to match up with what is happening.
Back to the drawing board then.