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
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