Skeen
Aug 8th, 2000, 05:26 AM
I'm trying to transport data from one file to a database. The program worked fine a few weeks ago but when I've come to use it, the following error message occurs:
"Syntax Error in INSERT INTO statement"
Here's the code for the module:
Option Explicit
Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As Long
Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long
Public Const MAX_PATH = 260
Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type
Public Const FILE_ATTRIBUTE_DIRECTORY = &H10
Public Const FILE_ATTRIBUTE_NORMAL = &H80
Public Sub WriteToDB(StarDateTime As String, EndDateTime As String, DurationSecs As String, CallersNumber As String, DialledNumber As String, TerminatingNumber As String, ValuePence As String)
Dim DBconnect As Database
Dim Query As String
Dim Resultset As Recordset
'connect to database
Set DBconnect = OpenDatabase("D:\OPAL_CDR_data_ftp.mdb")
'Standard Query
Query = "INSERT INTO Opal_CDR_data/July 2000(StarDateTime, EndDateTime, DurationSecs, CallersNumber, DialledNumber, TerminatingNumber, ValuePence) Values('" & StarDateTime & "','" & EndDateTime & "','" & DurationSecs & "','" & CallersNumber & "','" & DialledNumber & "','" & TerminatingNumber & "','" & ValuePence & "')"
******//HERES WHERE THE PROBLEMS BEGIN//******************
DBconnect.Execute (Query)
End Sub
As far as I can see the syntax is ok but does anyone know whats goining on.
Cheers n beers
"Syntax Error in INSERT INTO statement"
Here's the code for the module:
Option Explicit
Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As Long
Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long
Public Const MAX_PATH = 260
Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type
Public Const FILE_ATTRIBUTE_DIRECTORY = &H10
Public Const FILE_ATTRIBUTE_NORMAL = &H80
Public Sub WriteToDB(StarDateTime As String, EndDateTime As String, DurationSecs As String, CallersNumber As String, DialledNumber As String, TerminatingNumber As String, ValuePence As String)
Dim DBconnect As Database
Dim Query As String
Dim Resultset As Recordset
'connect to database
Set DBconnect = OpenDatabase("D:\OPAL_CDR_data_ftp.mdb")
'Standard Query
Query = "INSERT INTO Opal_CDR_data/July 2000(StarDateTime, EndDateTime, DurationSecs, CallersNumber, DialledNumber, TerminatingNumber, ValuePence) Values('" & StarDateTime & "','" & EndDateTime & "','" & DurationSecs & "','" & CallersNumber & "','" & DialledNumber & "','" & TerminatingNumber & "','" & ValuePence & "')"
******//HERES WHERE THE PROBLEMS BEGIN//******************
DBconnect.Execute (Query)
End Sub
As far as I can see the syntax is ok but does anyone know whats goining on.
Cheers n beers