create parameters dynamically?

  • Thread starter Thread starter Craig Buchanan
  • Start date Start date
C

Craig Buchanan

I would like to create a form that searchs for incidents. Obviously, the
user might select any combination of criteria. I have a query that does the
table joins that are needed and displays the appropriate fields.

I would like to be able to create parameters in code and somehow modify the
query to accept these parameters.

Is there a way to do this?

Otherwise, i can always write dynamic sql.

thanks,

craig
 
Craig said:
I would like to create a form that searchs for incidents. Obviously, the
user might select any combination of criteria. I have a query that does the
table joins that are needed and displays the appropriate fields.

I would like to be able to create parameters in code and somehow modify the
query to accept these parameters.

Is there a way to do this?

Otherwise, i can always write dynamic sql.


Bo way
 
Craig said:
I would like to create a form that searchs for incidents. Obviously, the
user might select any combination of criteria. I have a query that does the
table joins that are needed and displays the appropriate fields.

I would like to be able to create parameters in code and somehow modify the
query to accept these parameters.

Is there a way to do this?

Otherwise, i can always write dynamic sql.


Create the SQL dynamically.

If the query is being used as the record source for form or
report that you're going to open, then just construct the
OpenForm/OpenReport's WhereCondition argument.
 
marshall-

thanks for the reply. actually, i'm using form fields to restrict what is
being displayed in the form's listbox. can't use the openarg then.

i'm trying to take a class factory approach to searching. i have a class
called 'Incidents'. I would like to pass a collection of Parameters to the
Search method, then use these params to modify the query.

thoughts?
 
Construct the list box's RowSource dynamically.

I just don't see what good there is in the ability to add to
a querydef's Parameters collection when the query's SQL
statement doesn't have any syntax that uses the new
parameters? So, if you have to create the querydef's SQL
anyway, then you might as well skip the querydef and stuff
the SQL directly into the RowSource property.
 
Back
Top