I've read here: http://stackoverflow.com/questions/5...ter-in-a-query that you can use SWITCH to define a field as a parameter in a query. The example solution is said to work in Access, but uses an UPDATE query. See below:
How might the query look as a SELECT statement, or can this be done? I'm trying to use this to display 1 of 3 fields depending on which the user picks.Code:PARAMETERS WhichDate Long; UPDATE tblTarget AS t INNER JOIN tblSource AS s ON t.id = s.id SET t.date_assigned = Switch(WhichDate=1,date1,WhichDate=2,date2);
However, the code does not work. Thoughts?
Code:PARAMETERS WhichField Text ( 255 ); SELECT p.myID, s.docDate AS [myDate], myField = Switch(WhichField="Sales1",'s.Sales1',WhichField="Sales2",'s.Sales2',WhichField="Sales3",'s.Sales3') FROM prod AS p INNER JOIN sumDaily AS s ON p.prodID = s.entityID GROUP BY p.myID, s.docDate;