Query by form help

  • Thread starter Thread starter Michael Allen
  • Start date Start date
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top