|
-
Apr 18th, 2007, 11:47 PM
#1
Thread Starter
Junior Member
Comparing dates before transferring data from Access DB to Excel (ADO)
I'm guess I need to transfer the info into a buffer (recordset?), do the comparison, then only extract the relevant data to Excel? Is there a simpler way of doing this? And does anyone have links to examples?
Must the Format be identical (eg. Long Date vs Long Date, or can it be like Long Date vs Short Date) when it comes to comparing dates?
Furthermore, when i use the preset MM/DD/YYYY, whenever i enter a date like '10/12/2006' (12 Oct), it automatically reverts to '12/10/2006'... and if i enter 12/15/2006' (15 Dec), it doesn't seem to recognise the date at all! (btw, i'm using British settings for win xp)
Thanks in advance... need all the help i can get.
-
Apr 19th, 2007, 12:06 AM
#2
Re: Comparing dates before transferring data from Access DB to Excel (ADO)
What's your tentative select query? And what's the data type in the database? If the data type in the database is string then you will have to manually or progmatically parse the string to get the months and days.
-
Apr 19th, 2007, 12:30 AM
#3
Thread Starter
Junior Member
Re: Comparing dates before transferring data from Access DB to Excel (ADO)
 Originally Posted by leinad31
What's your tentative select query? And what's the data type in the database? If the data type in the database is string then you will have to manually or progmatically parse the string to get the months and days.
strQuery = "SELECT " & JobNo & ", " & JobName & " FROM " & "tblJobs" _
& " WHERE " & jobDate... (incomplete)
Basically, is it possible to have the End-user input 2 dates into Excel Cells, and the ADO extracts the relevant data based on whether the DB's jobDate is inbetween them?
So basically the ADO must address both Excel and Access in comparing the date values... have any good, simple examples?
-
Apr 19th, 2007, 04:30 AM
#4
Re: Comparing dates before transferring data from Access DB to Excel (ADO)
Excel has a copyfromrecordset method, search the method for sample code.
The WHERE clause depends on the data type of the relevant fields.
-
Apr 19th, 2007, 01:25 PM
#5
Re: Comparing dates before transferring data from Access DB to Excel (ADO)
If your localization is British, dates must be in dd/mm/yyyy format. Is this being written in Access VBA, Excel VBA, VB6, VB.net? A datepicker control or two, if available, would be your best bet.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Apr 19th, 2007, 06:50 PM
#6
Re: Comparing dates before transferring data from Access DB to Excel (ADO)
DateTime is datetime regardless of formatting... that's why he has to specify whether he used strings to store the dates (which will involve additional processing) or datetime.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|