Module

  • Thread starter Thread starter Sash
  • Start date Start date
S

Sash

Hopefully this will make sense.

I have a main form with a date range. From this form I execute many checks
against the data for this date range. One such check includes a Module that
I execute from a Open Form Event for a form called frmConcurrent. The code
in this event is:

Call CheckConcurrent
DoCmd.Requery

The reason I requery is that the form I'm opening may have changes based on
the processes in the module. Sorry, I'm still new to a lot of this, so may
be executing this all wrong. My question is that I want to only run the
module for a date range that exists on the Main Form. I know how to pass the
date on open forms, but just not sure how to do this in the module.
 
Obviously, I don't know the context of your database but there may be an
easier way to do this than writing code. If the secondary form you are
opening is based on a query, consider using a parameter wuery as the
ControlSource and define the criteria of the query something like this
(considering that the Main Form is still open):

(DateField) >= Forms!MainForm!Date01 AND <= Forms!MainField!Date02

Or...
If you are opening the secondary form with code, try something like this:

'************
DoCmd.OpenForm "Form2", , , "DateField >= #" & Forms!MainForm!Date01 _
& "# AND DateField <= #" & Forms!MainForm!Date02 & "#"
'************

Good luck.
 
Back
Top