Subquery causing unwanted parameter prompt ?

liamfitz

Registered User.
Local time
Today, 20:19
Joined
May 17, 2012
Messages
240
I have a 'DoCmd.OpenForm "frmAfAIS(test)", , qryTest', to open a form based on the Query ( qryTest ). It does this eventually, and in all other ways is perfect for requirement. The SQL for qryTest = SELECT c.Title, c.Forename, c.Surname
FROM tblClients AS c
WHERE c.Client_ID IN (SELECT c2.Client_ID
FROM qrySelectDistinctClient_IDByStaff c2);

However, it prompts me for parameters Forename and Surname, before opening the Form ( frmAfAIS(test)) ? How can I get it to just the load the form with the Recordset, without being prompted. P.S. The SQL for subquery - qrySelectDistinctClient_IDByStaff is :
SELECT DISTINCT tblReferrals.Client_ID
FROM tblReferrals;

Thank you. :confused::confused:
 
My purely personal opinion: One time I inherited a db full of filter-by-query forms. I kept having problems with filters uexpectedly being applied and "unriddable-of" , unexpected prompts etc etc.

I admit that I probably do not understand how it all works, but too short on time for experimentation, I eventually threw all that stuff out, and rewrote all the forms to either be based on a select query with parameters set elsewhere, or using the form's normal "WHERE- filter". Since that time, this is yet another Access-feature that I simply never use.

Update: As to your specific problem: there is an error in your query. You possess a built-in checker - the query builder. Paste your SQL there and make it run.
 
Last edited:
Are you certain your field names are correct?
 

Users who are viewing this thread

Back
Top Bottom