I am a novice with SQL - I usually work in the query grid. However I
am trying to find a way to change a field name depending upon what I
select from a combo box on a form. I created an unbound form allows me
to select any one of 20 field names from the Questionnaire table. When
I select a new one, for example "Discharges", I want to replace the
field "Admissions" (in the SQL below) with it. I have a button on my
form that Runs Query. Can I insert some code in the On Click of that
button to change my SQL statement?
SELECT Questionnaire.[Fiscal Year], Questionnaire.Quarter,
Count(Questionnaire.[ID Code]) AS [Admissions Questions Samples]
FROM Questionnaire
WHERE (((Questionnaire.Admissions) Is Not Null And
(Questionnaire.Admissions)<>0) AND
((Questionnaire.OmitFromAnalysis)=False))
GROUP BY Questionnaire.[Fiscal Year], Questionnaire.Quarter;
Any help is very much appreciated.