StartupForm based on results of query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to have a "flag" set up to open a form if contracts are up for
renewal. I have written a query that works fine (compares current date to
contract end date), but I'm having trouble figuring out how to get a form to
open or not, depending on the results of the query.

Ideally, I'd like the form to be the first thing the user sees when
launching the database, but ONLY if there are contracts up for renewal.

Any help would be appreciated!
 
A simple way to do it is to use a macro with a condition on an OpenForm
action. In your macro design view, if you don't see a column headed
Conditions on the left then go View > Conditions; the condition can be a
simple DCount function on the query, like:

DCount("*","YourQueryName") > 0

so the form is opened if the query returns one or more records.
Additionally, ff you name the macro Autoexec, then it will run
automatically every time you open the database.

HTH,
Nikos
 
Back
Top