Parameter Query

uplink600

Registered User.
Local time
Today, 08:26
Joined
Mar 18, 2004
Messages
69
Good Morning Guys

This is a form related query problem.

I have set up a dialog box/form to act as a custom query builder. The user can enter various search information using a selection of textboxes and combos.

The query design as as follows. (this is just for one field of the query, the other fields are built in the same way).

In the field section I have the following

[SalesPerson]=[Forms]![Search]![cboSalesPerson] Or [Forms]![Search]![cboSalesPerson] Is Null

The SQL is

SELECT Main.RecordNumber
FROM Main
WHERE ((([SalesPerson]=Forms!Search!cboSalesPerson Or Forms!Search!cboSalesPerson Is Null)=True))
ORDER BY Main.RecordNumber;

Criteria is set as TRUE

This is just one part of the query, I won't set the other fields up until I get this working. On the form the user will select the sales person name from cboSalesPerson and then click the cmdSearch button. cmdSearch runs a macro which opens the query, currently in datasheet view, but later it will be a form or report view.

The trouble is this won't work at present. If I run the query from it's design view it ask's for the parameter and works fine. It just won't work when run from the cmdSeach button on the custom search form. It seems the value in the combo is not passed to the query.

Any ideas what might be wrong please.

Thanks

VC
 
Is the query/table that your combo is based on bound to the right field? It must be bound to the same field that the main query is looking for.

Just a thought...
 

Users who are viewing this thread

Back
Top Bottom