Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date filtering in Access query using Access data and linked Excel data

Status
Not open for further replies.

BONDfan

Programmer
Feb 20, 2002
12
US
I am currently having issues filtering data in a query. I have linked an Excel Spreadsheet and a data table in Access. The Excel table contains Sales Order data. The Access table is linked to an Access form in which a Start and End date are retrieved from a user. These user dates are then used in the Access query, which is filtered against a Scheduled Ship Date in the linked Excel table. The Scheduled Ship Date has the format of 'm/d/yyyy h:nn'. I currently have no format set on the Access dates. I can't seem to find the correct format.

I use 'Between [REPORT-SEL]![SDAT] And [REPORT-SEL]![EDAT]' in the Query Criteria for the Scheduled Ship Date filter.

I have tried going into the Excel and setting the format there. Then I try to set the format to the same thing in the form used to input the dates in Access. To look at the linked Excel file, it doesn't appear to have the time stamp with the date, UNTIL you click on one of them - then you can see it is still there.

Consequently, as an example, I enter a Start Date of '01/01/2006' and an End Date of '01/20/2006', even though there are definitely records with the Scheduled Ship Date of '01/20/2006', I get everything BUT those dates - whatever the end date value is, I get everything up to, but not including the end date itself.

Any one have any suggestions? I'ved tried making all the formats match between the user input form and the Excel spreadsheet. Even though I have experience, it's not alot. I have a work-around in place - I use 'Between [REPORT-SEL]![SDAT] And DateAdd("d",1,[REPORT-SEL]![EDAT])', and this seems to work, but I have run up against this very same problem in 2 different Access databases in the past week. If there is a way to do it correctly, I'd rather do it that way - I want to do it right! Not use a work-around.

Please forgive me for using CAPS in some of my question (other than the filter statement) - I use it as a form of emphasis - not yelling. Believe me. I man a Help Desk here where I work and I roil at people who submit their problems in all caps - I feel like I'm being yelled at....

Anyway, thanks for any help you can suggest. It's would be very much appreciated!
 
You may try this:
Between [REPORT-SEL]![SDAT] And ([REPORT-SEL]![EDAT] + #23:59:59#)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PH,

Thanks loads! Worked like a charm!

It's rather difficult to get classes approved hwere I work, so I have to rely on good people like you for help while learning (and sometimes when I seem to have my eyes closed!)

Can you recommend a book that would cover building an application - requiring user input, linking Excel files, building queries, reports, etc....?

Thanks Again!
BONDfan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top