Wrox Programmer Forums
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 24th, 2004, 08:10 AM
Registered User
Join Date: Jan 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Querying .csv files

I am collecting information from a database into a .csv file. I also want to query this .csv file and based on a timestamp field in the .csv flie, select only certain rows. The front-end that I am using is VB 6.0.

I am facing the following problems -
1) I am not able to directly query the file using the timestamp field
2) I tried to import the .csv file into an MS-ACCESS database - there is a mismatch in the timestamp datatype.

Can anyone help ASAP? The result is very time critical.

Thanks in advance,

Old January 26th, 2004, 08:40 AM
Authorized User
Join Date: Jun 2003
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts

why not query the database before you export the csv-file?

Old January 26th, 2004, 01:26 PM
sal sal is offline
Friend of Wrox
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts

Try to link the CSV file into Access, create a query that formats your data properly and call that query via ADO.

Should work fine.

Old February 24th, 2004, 02:40 PM
Friend of Wrox
Join Date: Feb 2004
Posts: 177
Thanks: 0
Thanked 0 Times in 0 Posts

I have tried exporting to the access file, but in the timestamp field the seconds part is missing, also I am not able to query properly, because while exporting it take the column as string not timestamp. If I manually change the column to Timestamp also it is not working.

Can anyone help please!

It is not how much we do,
but how much love we put in the doing.

-Mother Theresa
Old February 25th, 2004, 01:01 PM
Authorized User
Join Date: Feb 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts

Are you sure that the "seconds" is really missing or is the field just formatted so you don't see it? I've put things into databases where the field is date/time, and incldued the seconds, and not lost the seconds.

If you have MSquery installed, it will write a query for you closer to that accepted by ADO than will Access, but both will work after editing.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot retrieve string data in CSV and Excel files ajimi VBScript 13 March 19th, 2008 09:59 AM
Accessing csv, text(tab), xls files rahulsurya ADO.NET 0 November 6th, 2007 03:11 PM
Import CSV files to Database in C# prasanna.nadgir C# 2 September 4th, 2007 11:03 AM
Combining *.csv files sing FileInfo class mhite05 C# 0 October 25th, 2005 09:53 AM
using csv files for web publishing antonyx Javascript 0 May 2nd, 2005 09:08 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.