Slight changes in queries such as optional search fields can be handled by writing a more complicated SQL statement that uses indicator variables and IIf() functions. This is not too difficult but it works for rather limited situations. I think that retrieving data from alternative tables definitely will require a different query for every table.
The notion of dynamic queries rests on the use of a procedural language that builds different queries based on the data received from a form. In Access this would be VBA, Visual Basic for Applications, or whatever the current Microsoft offering might be. If your application is web based, then use the scripting language to build a string that is submitted as the SQL statement.
Code:
/* Maybe a criterion is optional when the menu selection is "Any". */
SELECT good, things
FROM CurrentBudget
WHERE
( @Dept = "Any" OR Department = @Dept )
AND
TxDate BETWEEN @dtBegin AND @dtEnd
(The symbols that begin with @ are the values supplied by the form.)
Code:
/* Maybe a criterion is optional unless a checkbox for a field is selected. */
SELECT good, things
FROM CurrentBudget
WHERE
( @DeptSearch = False OR Department = @Dept )
AND
TxDate BETWEEN @dtBegin AND @dtEnd
Here the form has a field to specify that a criterion should be used in the query. The value of that field, @DeptSearch, is used in the query.
In these examples, the first condition in the WHERE clause is always true if we dont want to use the field as a criterion. If that condition is false then only the rows with the specified value are retrieved.
Code:
/* Build a SQL statement based of the form data, then submit it. */
Dim strSQL
strSQL = "SELECT good, things FROM "
strSQL = strSQL & formTableName
strSQL = strSQL & " WHERE 1=1 "
If DeptSearch = True Then
strSQL = strSQL & " AND Department = formDept"
End If
strSQL = strSQL & " AND TxDate BETWEEN #" & formDtBegin "# AND #" & formDtEnd & "#"
Here the formDept variables have the values provided by the form. In this case the form could specify alternative tables and the code would build an appropriate query.
Hope this gives you a couple of general ideas. The code does not run.