#  Other Applications & Softwares  > Access Tables & Databases >  >  Add parameter manually to command text

## chris35moto

EXCEL 2007

Hey guys,

So heres my problem...

I wrote a SQL query without using the wizard or ms query. It connects to a SQLOLEDB. Now all I need to do is add a couple parameters to be defined from within the workbook. I cannot get the parameters option to not be grayed out under connection properties. 

Supposedly when you put a question mark into the command text it should propt you to define the parameter. When I run the simple query attached I just get an error stating that the param is not defined. 

What should I do?

Thanks
-Chris

----------


## alansidman

I haven't gone down this road this way, but is there any reason that you cannot write your parameter directly into your WHERE clause

something like WHERE taskisactive = "Yes";

----------


## chris35moto

The problem is that I need the parameter to ultimately be determined by a vba menu like a check box list. My query is the basis for a chart. I need users to be able to select the data category to be displayed.

Theres over 1000 ways the data can be spun so I can't build individual reports. 

it would look something like :

select enginetype from table where carcolor = ?

Then have a checkbox menu listing [ red, blue, green ].

Right now I simply have no way to define the parameters from within the workbook

----------


## alansidman

Found this while looking for something else.  Thought it might be helpful to your cause.

http://datapigtechnologies.com/blog/...one-parameter/

----------


## chris35moto

I essentailly found that my command string is too complicated to add parameters to. If I try adding one, I get an error saying that there are too many rows.

----------

