SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old July 4th, 2004, 12:02 AM
Preacha Preacha is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 8 Preacha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
SQL error message

Hi Guys. I've been wanting to import a weird file into access with a header followed by columns of data . . Like the following . . .

Count interval: 15 min Detector: Tube Vehicle interval: n/a
Counter No: 3008 Firmware version: 2.04
Counter read at: 13:16:51 on 15/06/2004
First count recorded at: 16:00:00 on 11/06/2004
Last count ended at: 13:15:00 on 15/06/2004
Total vehicles recorded: 44696 Total axles recorded: 89429
Detector spacing: 1000mm Channel 1
Site log: Žempty¯
__________________________________________________ ____________________

Date Time Cl Spd Unclass

11/06 16:00 1 63
11/06 16:00 1 64
11/06 16:00 1 60
11/06 16:00 1 59
11/06 16:00 1 56
11/06 16:00 1 54
11/06 16:00 1 61
11/06 16:00 1 63
11/06 16:00 1 61
11/06 16:00 1 54
11/06 16:00 1 56
11/06 16:00 1 56
11/06 16:00 1 55
11/06 16:00 1 55
11/06 16:00 1 61
11/06 16:00 1 59

The error occured next to the bold Anyway I get the following error, "Runtime error: 3061" "Too few parameters. Expected 1". Does anyone know what this would mean? The code is below . .. .

Option Compare Database

Private Sub Command0_Click()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim sql As String
Dim buf As String

'
' Open your file
'
Open "C:\Documents and Settings\Steve\Desktop\counterDB\Speed TBL's\104.TBL" For Input As #1
'
' Skip until there's a date
'
buf = "Starting ..."
While (Not IsDate(Mid(buf, 1, 5))) And Not EOF(1)
Line Input #1, buf
Wend
If EOF(1) Then
MsgBox ("Problems with the file.")
Exit Sub
End If

'
' Process the file
'
' +- Field1
' |
' TheDate | +- Field2
' | | |
' V V V
'=========== = ==
'11/06 16:00 1 63
'11/06 16:00 1 64
'11/06 16:00 1 60

Set dbs = CurrentDb
While Not EOF(1)
'
' Does it exist in your table?
'
sql = "SELECT * " & _
"FROM SpeedImport " & _
"WHERE Date = #" & Mid(buf, 1, 5) & "# AND " & _
"Time = #" & Mid(buf, 7, 5) & "# AND " & _
"Cl = " & Mid(buf, 14, 1) & " AND " & _
"Speed = " & Mid(buf, 16, 3)

Set rst = dbs.OpenRecordset(sql)
If rst.EOF And rst.BOF Then
'
' It is new, add it
'
rst.AddNew
rst!Date = Mid(buf, 1, 5)
rst!Time = Mid(buf, 7, 5)
rst!Cl = Mid(buf, 14, 1)
rst!Speed = Mid(buf, 16, 3)
rst.Update
Else
'
' It is already there, leave it
'
End If
Set rst = Nothing
Line Input #1, buf ' Retrieve next line
Wend
Close #1
End Sub

Thanks

Reply With Quote
  #2  
Old July 4th, 2004, 08:29 AM
Preacha Preacha is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 8 Preacha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry made some changes

I've made some changes since then. Fields "Date" and "Time" have been changed to "RecordDate" and "RecordTime" respectively. Still got the same problem tho

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > SQL error message


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT