start date and end date in unbound form

J

jackie

Can someone tell me what's wrong with this code. First it works, then it
stops working.
I have 4 unbound boxes on a form. Dodaac, Supply Chain, Start Date and End
Date. It's the date I'm having a problem with.
I can enter a dodaac and supply chain, or a dodaac or a supply chain.
However, when I enter a start date and end date, I get records but not for
the date range i enter. my critieria looks like this:

For the Supply Chain
Like "*" & Forms![QBF_form]![supply_chain] & "*" Or
Forms!QBf_Form![supply_chain] Is Null

For the Dodaac
Like "*" & Forms![QBF_form]![dodaac] & "*" Or Forms!QBf_Form![dodaac] Is Null

For the Created on date
Between Forms![QBF_Form]![TxtStartDate] And Forms![QBF_Form]![TxtEndDate] Or
Forms![QBF_Form]![TxtStartDate] And Forms![QBF_Form]![TxtEndDate] Is Null

FYI I've tried it like this:
Between [Forms]![QBF_Form]![TxtStartDate] And [Forms]![QBF_Form]![TxtEndDate]

Here's the SQL:
SELECT Jan_08_Orders.[Profit Center], Jan_08_Orders.DoDAAC,
Jan_08_Orders.CreatedOn, Jan_08_Orders.[Order Qty], Jan_08_Orders.[Shipped
Qty], Jan_08_Orders.[Net Value]
FROM Jan_08_Orders
WHERE (((Jan_08_Orders.[Profit Center]) Like "*" &
[Forms]![QBF_form]![supply_chain] & "*") AND ((Jan_08_Orders.DoDAAC) Like "*"
& [Forms]![QBF_form]![dodaac] & "*") AND ((Jan_08_Orders.CreatedOn) Between
[Forms]![QBF_Form]![TxtStartDate] And [Forms]![QBF_Form]![TxtEndDate])) OR
(((Jan_08_Orders.[Profit Center]) Like "*" &
[Forms]![QBF_form]![supply_chain] & "*") AND ((Jan_08_Orders.DoDAAC) Like "*"
& [Forms]![QBF_form]![dodaac] & "*") AND (([Forms]![QBF_Form]![TxtStartDate]
And [Forms]![QBF_Form]![TxtEndDate]) Is Null)) OR (((Jan_08_Orders.DoDAAC)
Like "*" & [Forms]![QBF_form]![dodaac] & "*") AND
(([Forms]![QBf_Form]![supply_chain]) Is Null)) OR (((Jan_08_Orders.[Profit
Center]) Like "*" & [Forms]![QBF_form]![supply_chain] & "*") AND
(([Forms]![QBf_Form]![dodaac]) Is Null)) OR
((([Forms]![QBf_Form]![supply_chain]) Is Null) AND
(([Forms]![QBf_Form]![dodaac]) Is Null));

I went in and recreated the query for the hundredth time and it worked for a
while, then it stopped working. Any help would be appreciated.
 
D

Douglas J. Steele

Please don't post so many threads for the same issue!

These newsgroups are manned exclusively by volunteers. It's not unreasonable
for a few hours to go by before someone answers (if at all).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top