Set value of control in event procedure

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

Guest

I have several reports in my database which correlate to different types of
real estate properties (vacant land, commercial property, etc.) that are
stored in the same master properties table. All the reports run off the same
underlying query. When a user queries the table, he or she first selects the
appropriate report type. All the reports lead to the same unbound form that
accepts the parameters for the search. One of the parameters for the search
allows the user to select a property type (the field name is [Use]).

I would like for the parameter form to automatically fill in a particular
type of property based on the user's report selection. For instance, if the
user selects the vacant land report, when the parameter form pops up, I would
like for the [Use] field to be automatically set to "Vacant". I feel like
the natural place to put such a command is in the OnOpen event procedure of
the report, which currently brings up the parameter form. What is the
correct syntax for this sort of command?

I am using Access 2003, mdb file format. Thank you very much for you help-

Wil Loftis
 
As you are opening the parameter form from the Open event of the Report, use
the OpenArgs argument of the DoCmd.OpenForm to pass the default value for
Use to the parameter form. In the Open or Load event of the parameter form,
use the OpenArgs property of the Form to obtain the value and set it into
whatever control is used to display/accept it.

Larry Linson
Microsoft Access MVP
 
Thank you very much...I was just able to return to this problem today, and
your solution worked wonderfully. Sorry for the delay in acknowledging your
helpful response!

Larry Linson said:
As you are opening the parameter form from the Open event of the Report, use
the OpenArgs argument of the DoCmd.OpenForm to pass the default value for
Use to the parameter form. In the Open or Load event of the parameter form,
use the OpenArgs property of the Form to obtain the value and set it into
whatever control is used to display/accept it.

Larry Linson
Microsoft Access MVP

I have several reports in my database
which correlate to different types of
real estate properties (vacant land,
commercial property, etc.) that are
stored in the same master properties table.
All the reports run off the same under-
lying query. When a user queries the table,
he or she first selects the appropriate
report type. All the reports lead to the
same unbound form that accepts the
parameters for the search. One of the
parameters for the search allows the
user to select a property type (the field
name is [Use]).

I would like for the parameter form to
automatically fill in a particular type of
property based on the user's report selection.
For instance, if the user selects the vacant
land report, when the parameter form pops
up, I would like for the [Use] field to be
automatically set to "Vacant". I feel like
the natural place to put such a command
is in the OnOpen event procedure of the
report, which currently brings up the para-
meter form. What is the correct syntax for
this sort of command?

I am using Access 2003, mdb file format.
 
Back
Top