Hi all. I'm trying to edit the criteria of a simple select query on the fly by amending the query's SQL statement. I'm trying to do this exclusively by macros and NOT by VBA. Basically, I want to append the WHERE portion to the query's SQL statement. The contents of the WHERE portion is handled by a form. Using a number of SendKeys actions, I am able to copy the content of the unbound text box that contains the WHERE statement by Ctrl + C. The SendKeys code for this is : ^(c)
At this stage, I manually test to see if the WHERE statement was copied by pasting into notepad and it correctly pastes the WHERE statement. But for some reason, when I open the query in design view (via the same macro) and then use SendKeys to paste, the wrong thing is pasted. It's the whole SQL statement of the query that is pasted instead of just appending the WHERE portion at the end of the statement.
The MS Access file is attached. Please help fix this. Thanks.
I've tried both MS Access 2013 and 2019 (not on the same PC).