G
Guest
Hi can anyone hlep?
I have written a query In Access 2002 that runs off a form.
The form has four combo boxes & two text boxes.
Business Development (Combo)
Commercial (combo)
Customer (Combo)
Status (combo)
Beginning Date (txt)
End Date (Txt)
So the user could be really specific & use all of the criteria to narrow
down the records shown by selecting data in all options or just one/two combo
boxes/text boxes.
Before i added the txt boxes the query worked fine. user selected Customer
name from list & Status from the list & ALL records matching those 2 criteria
would be shown.
However as soon as i added the text boxes it would ONLY bring up the records
matching the dates & ignore any other criteria from the combo boxes.
E.g user selected Commercial 'Angie',
Beginning Date '10/1/2004'
End Date '10/30/2004'
Here is a simplified version of my SQL.I have included nulls because i want
the user to have the option not to select all of the categories.
SQL:
SELECT [Tender Detail].[Tender Number], [Tender Detail].Commercial, [Tender
Detail].[Business Development Staff], [Tender Detail].Customer, [Tender
Detail].ProductDescription, [Tender Detail].[Date Received], [Tender
Detail].[Date Due], [Tender Detail].[Tender Sent], [Tender detail.Date
Due]-[Tender detail.Date Received] AS [Weeks 4], [Tender Detail.Tender
Sent]-[Tender Detail.Date Received] AS [Weeks 5], [Tender Detail.Weeks
5]-[Tender Detail.Weeks 4] AS [Weeks 6], [Tender Detail].[Order Status],
[Tender Detail].[Quote Value]
FROM [Tender Detail]
WHERE (([Tender Detail].Commercial =[Forms]![frmRFQ Receipt to Tender
Sent]![CboCommercial] Or "«Expr»" Like [Forms]![frmRFQ Receipt to Tender
Sent]![CboCommercial] Is Null)) AND
(([Tender Detail].[Business Development Staff])=[Forms]![frmRFQ Receipt to
Tender Sent]![CboBusiness Development Staff] Or "«Expr»" Like [Forms]![frmRFQ
Receipt to Tender Sent]![CboBusiness Development Staff] Is Null)) AND
(([Tender Detail].Customer)=[Forms]![frmRFQ Receipt to Tender
Sent]![CboCustomer] Or "«Expr»" Like [Forms]![frmRFQ Receipt to Tender
Sent]![CboCustomer] Is Null)) AND
(([Tender Detail].[Date Due]=Between [Forms]![frmRFQ Receipt to Tender
Sent]![txtbegdate] And [Forms]![frmRFQ Receipt to Tender Sent]![txtenddate]
Or "«Expr»" Like [Forms]![frmRFQ Receipt to Tender Sent]![txtbegdate] And
[Forms]![frmRFQ Receipt to Tender Sent]![txtenddate] Is Null)) AND
(([Tender Detail].[Order Status])=[Forms]![frmRFQ Receipt to Tender
Sent]![CboStatus] Or "«Expr»" Like [Forms]![frmRFQ Receipt to Tender
Sent]![CboStatus] Is Null))
Not sure why the query is ignoring the other criteria? Any ideas?
Thanks in Advance
Michelle
I have written a query In Access 2002 that runs off a form.
The form has four combo boxes & two text boxes.
Business Development (Combo)
Commercial (combo)
Customer (Combo)
Status (combo)
Beginning Date (txt)
End Date (Txt)
So the user could be really specific & use all of the criteria to narrow
down the records shown by selecting data in all options or just one/two combo
boxes/text boxes.
Before i added the txt boxes the query worked fine. user selected Customer
name from list & Status from the list & ALL records matching those 2 criteria
would be shown.
However as soon as i added the text boxes it would ONLY bring up the records
matching the dates & ignore any other criteria from the combo boxes.
E.g user selected Commercial 'Angie',
Beginning Date '10/1/2004'
End Date '10/30/2004'
Here is a simplified version of my SQL.I have included nulls because i want
the user to have the option not to select all of the categories.
SQL:
SELECT [Tender Detail].[Tender Number], [Tender Detail].Commercial, [Tender
Detail].[Business Development Staff], [Tender Detail].Customer, [Tender
Detail].ProductDescription, [Tender Detail].[Date Received], [Tender
Detail].[Date Due], [Tender Detail].[Tender Sent], [Tender detail.Date
Due]-[Tender detail.Date Received] AS [Weeks 4], [Tender Detail.Tender
Sent]-[Tender Detail.Date Received] AS [Weeks 5], [Tender Detail.Weeks
5]-[Tender Detail.Weeks 4] AS [Weeks 6], [Tender Detail].[Order Status],
[Tender Detail].[Quote Value]
FROM [Tender Detail]
WHERE (([Tender Detail].Commercial =[Forms]![frmRFQ Receipt to Tender
Sent]![CboCommercial] Or "«Expr»" Like [Forms]![frmRFQ Receipt to Tender
Sent]![CboCommercial] Is Null)) AND
(([Tender Detail].[Business Development Staff])=[Forms]![frmRFQ Receipt to
Tender Sent]![CboBusiness Development Staff] Or "«Expr»" Like [Forms]![frmRFQ
Receipt to Tender Sent]![CboBusiness Development Staff] Is Null)) AND
(([Tender Detail].Customer)=[Forms]![frmRFQ Receipt to Tender
Sent]![CboCustomer] Or "«Expr»" Like [Forms]![frmRFQ Receipt to Tender
Sent]![CboCustomer] Is Null)) AND
(([Tender Detail].[Date Due]=Between [Forms]![frmRFQ Receipt to Tender
Sent]![txtbegdate] And [Forms]![frmRFQ Receipt to Tender Sent]![txtenddate]
Or "«Expr»" Like [Forms]![frmRFQ Receipt to Tender Sent]![txtbegdate] And
[Forms]![frmRFQ Receipt to Tender Sent]![txtenddate] Is Null)) AND
(([Tender Detail].[Order Status])=[Forms]![frmRFQ Receipt to Tender
Sent]![CboStatus] Or "«Expr»" Like [Forms]![frmRFQ Receipt to Tender
Sent]![CboStatus] Is Null))
Not sure why the query is ignoring the other criteria? Any ideas?
Thanks in Advance
Michelle