Query methods

  • Thread starter Thread starter Monty
  • Start date Start date
M

Monty

The topic doesn't refer to typical Access "methods", say as a method
attached to or associated with a control.

I'm referring to ways of building a select query based on control
property values and how I might arrange them in a query.

I have some controls on a form that become enabled and disabled
depending on whther or not those controls have one or more date
values. For fields that have one value, the associated control
presents that value in a plain text box. For fields with mulitple
values, the associated control presents those values in a combo box.
The controls overlay one another and their appearance is control by
VBA statements turning on and off the respective control's 'enabled'
and 'visible' properties. The code is written so that no two overlaid
controls will be enabled at the same time.

However, on the form is a command button that runs a query based on
values displayed in this form. My problem occurs when the query must
decide which of the controls are enabled and which aren't.

Is there a way to determine in a query which controls are enabled?
That would be a good start.

Thanks
 
Is there a way to determine in a query which controls are enabled?
No

Consider: add a new invisible "CurrentValue" control to the form. In the
code where you handle visibility and enabling issues, fill CurrentValue
appropriately. Point your query to CurrentValue.

or variation of the above, call your new control CurrentStatus. Fill it with
the enabled control name or tag as controls become enabled. Then incorporate
that information into your query via iff().

HTH,
 
Is there a way to determine in a query which controls are enabled?
That would be a good start.

Monty,

It depends on what you want in your query.

If you write a VBA function that uses DAO code to examine the controls on your form, you
can then have the function return whatever value/data it is you would like based on the
properties of those controls. You can return True, False, whatever.

Once you have the function, then write a query using that VBA function.

There will be a performance hit on the query for using this function, depending on how
many times it has to execute it.


Sincerely,

Chris O.
 

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