Query by form help

M

Michael Allen

I use query by form often to filter query data based on the parameters
contained in a form. Is it possible to change the parameters in a
query when the form name changes, ie I would like to re-use the query
using parameters based on varying 'source' form names.

Example-Same query but with changing paramaters.

Forms!frmFormX!StaffID
Forms!frmFormY!StaffID
 
M

Michel Walsh

Hi,


Nope. Well, yes, but that is not "intended", neither flexible. We need
another parameter to indicate which form:


iif( whichForm = 1, Forms!frmFormX!StaffID , Forms!frmFormY!StaffID )


will use FormX is whichForm=1, and FormY otherwise.


You can also build the statement in a string, and then execute (or open the
recordset) based on that string.


Hoping it may help,
Vanderghast, Access MVP
 
Top