473,320 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Import in the DB Access CSV files

Hi all.

With ASP I read and register in the DB ACCESS, this lines a CSV file:

Expand|Select|Wrap|Line Numbers
  1.  
  2. 29/06/2008 00:15:48
  3. 29/06/2008 00:34:54
  4. 29/06/2008 07:28:03
  5. 29/06/2008 07:38:03
  6. 29/06/2008 08:52:33
  7. 29/06/2008 12:43:14
  8. 29/06/2008 13:18:58
  9. 29/06/2008 14:26:04
  10. 29/06/2008 15:28:05
  11. 29/06/2008 15:39:13
  12. 29/06/2008 15:42:54
  13. 29/06/2008 16:09:16
  14. 29/06/2008 17:18:46
  15. 29/06/2008 19:27:23
  16. 29/06/2008 21:27:23
  17.  
  18.  
You can exclude the lines when difference between the first row and the second row less than 30 minutes?

For example:

Expand|Select|Wrap|Line Numbers
  1.  
  2. 29/06/2008 00:15:48    Yes
  3. 29/06/2008 00:34:54    Not
  4. 29/06/2008 07:28:03    Yes
  5. 29/06/2008 07:38:03    Not
  6. 29/06/2008 08:52:33    Yes
  7. 29/06/2008 12:45:14    Yes
  8. 29/06/2008 13:10:58    Not
  9. 29/06/2008 14:26:04    Yes
  10. 29/06/2008 15:28:05    Yes
  11. 29/06/2008 15:39:13    Not
  12. 29/06/2008 15:42:54    Not
  13. 29/06/2008 16:09:16    Yes
  14. 29/06/2008 17:18:46    Yes
  15. 29/06/2008 19:27:23    Yes
  16. 29/06/2008 21:27:23    Yes
  17.  
  18.  
It' possible?
Any suggestions ?

Thanks, regards
Jul 3 '08 #1
3 1418
DrBunchman
979 Expert 512MB
Hi Mike,

Rather than trying to explain this one I've written a bit of pseudo-code to help you:

Expand|Select|Wrap|Line Numbers
  1.  Dim Row1_Time, Row2_Time 
  2. Dim flagDiff
  3. Do Until oRS.EOF
  4.  
  5.      'Get the values from the first row
  6.      Row1_Time = oRS("Time")
  7.  
  8.      'Move the recordset on to the next record
  9.      oRS.MoveNext
  10.  
  11.      'Get the values from the second row
  12.      Row2_Time = oRS("Time")
  13.  
  14.      'Check the difference between them and set the flag
  15.      If difference between Row1_Time and Row2_Time < 30 minutes Then
  16.          flagDiff = "Yes"
  17.      Else
  18.          flagDiff = "Not"
  19.      End If
  20.  
  21.      'Now write the FIRST line to the CSV file
  22.      Response.Write Row1_Time & flagDiff 
  23.  
  24. 'Now loop back to the start. You DON'T move on to the next record at this point because you want the record which is currently stored as Row2 to be set as Row1 on the next loop
  25. Loop
  26.  
Hopefully you can use this example to build a working script. Let me know how you get on.

Dr B

EDIT: Just thought about it and you'll need to do a check that the recordset is not EOF before you try to move to the next record or it will error when it reaches the last one.
Jul 3 '08 #2
thank's ! it's right !
Jul 4 '08 #3
DrBunchman
979 Expert 512MB
No problem, glad I could help.

Dr B
Jul 4 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: The Pig | last post by:
Guys, Got a bunch of DBF files all named pikcup.dbf. They are all stored under a directory named c:\reports but are all under multiple sub directories. I need Access to import all pickup.dbf...
1
by: Dan | last post by:
Could someone please help me with auto importing a series of data files into an Access table. I tried to follow code given below in a previous messagebut i'm getting error messages. Here's my...
3
by: ninrulz | last post by:
I will try to explain my situation. I know that it is hard to offers solutions without fully understanding what people would like to achieve. I receive 2 csv files every month. The csv files...
6
by: provor | last post by:
Hello, I have the following code that I am using when a user presses a button to import an excel file into a table. The code is hard coded to point to the correct table. This works great for this...
3
by: NigelBrown | last post by:
Hi All, I have the below code but have a couple of problems that I cannot solve, firstly when I select a file the dialog box will promt me to select the file a second time then import, even though...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.