Avatar of developingprogrammer
developingprogrammer
 asked on

weird date filtering

hey guys, i've got these lines of code and the funny thing is that when my

txtServicingWorkHoursStartDate = "28 nov"
txtServicingWorkHoursEndDate= "30 nov"

it works fine.

but if i change my txtServicingWorkHoursEndDate to anywhere between 1 dec to 11 dec it doesn't work. meaning no records shown - even the ones from 28 to 30 nov which was showing properly previously. even if i use 01 dec or 1 dec 2012 or 01 dec 2012. this is quite strange. any possible explanations?

Forms!frmMTKManager.subfrmServicingWorkHours.Form.Filter = "[CalendarDate] >= #" & DateValue(Me.txtServicingWorkHoursStartDate) & "# AND [CalendarDate] <= #" & DateValue(Me.txtServicingWorkHoursEndDate) & "#"
    Forms!frmMTKManager.subfrmServicingWorkHours.Form.FilterOn = True
    Forms!frmMTKManager.subfrmServicingWorkHours.Form.AllowFilters = False

btw datevalue is giving me the correct dates - i've tested it with ?month(DateValue(Me.txtServicingWorkHoursEndDate)  in the immediate window. thanks guys!!

update - it gives me the same problem for the start date. if i put the start date as anything before 1 dec to 11 dec it works fine.

start date 12 dec and end date 12 dec gives me records for 12 dec. when i change start date to 11 dec bham! i get records from 26 oct to 12 dec. so weird!!!! (compacting and repairing the database doesn't help as well!!)
Microsoft Access

Avatar of undefined
Last Comment
developingprogrammer

8/22/2022 - Mon
Flyster

Is your data just from this year or do you have data from previous years? The date value of 11/30/12 is 41243. For 2011 it's 40877. That could make the difference.

Flyster
developingprogrammer

ASKER
it's just this year, but even when i put in the year dd mmm yyyy format it still doesn't work
IrogSinta

Is the field CalendarDate in your table a Date data type or a Text data type?  It should be the former.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
developingprogrammer

ASKER
it's already date / time in the underlying table = (
IrogSinta

Try this format - 12/11/2012 to 12/12/2012 and see what the result is.
developingprogrammer

ASKER
same result = ((
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
IrogSinta

Can you upload a copy with just the problem forms and table?  Just remove any private information first.
developingprogrammer

ASKER
hey irogsinta so sorry my database is all so tightly coupled that removing all the data or just taking out the tables / queries would be so difficult. instead i captured all the screenshots and here it is in the zip file. do let me know if you want to see other tables / queries / forms / code
Database-Screenshots.zip
developingprogrammer

ASKER
irogsinta how bout using the criteria of the QBE? could you help me correct my syntax if it's wrong? not sure why i can't get this query to work. thanks!!
QBE.png
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
IrogSinta

I don't think I could be of much help with just these screenshots.  Although, from the screenshot of your form, I would recommend that you add a date format property to your textboxes so that the user can select a date from the popup calendar instead of typing a date.  That way the format is consistent.
IrogSinta

As for your question on the syntax in QBE, that's not right.  It should be
<= Forms!frmMTKManager!txtServicingWorkhoursStartDate

The name of the tab control is not part of syntax in referring to a control in one of its pages.
developingprogrammer

ASKER
great irogsinta!! i managed to extract the tables and forms with some help. the problem lies in mtk manager work hours tab. here's the access database!! = ))
Query.mdb
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
IrogSinta

It seems to work fine with these dates:
screenshotCapture.JPG
developingprogrammer

ASKER
yup yup, i understand, but when i put any date from 1 - 11 dec it doesn't work just like the previous post.

here are the screenshots
problem.png
ok.png
SOLUTION
IrogSinta

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
developingprogrammer

ASKER
Crap... I'm in trouble then = (( what do I do?? = ((
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
IrogSinta

Do you have another system you can try your database on?
developingprogrammer

ASKER
I don't right now but I need to get it to work on my computer. Is there anything I can do to troubleshoot this?
IrogSinta

Try the query.mdb database you uploaded.  Does it work there?  If so, then you may want to try copying all your objects to a new database and see if that takes care of the issue.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
developingprogrammer

ASKER
my solution was only a workaround - didn't fix the main problem