P
Peter Clancy
Hi,
I need a second pair of eyes to glance over this statement because I cannot
spot the syntax error in it.
The data is being saved into a table called Calldata which has the following
field definitions:
ANumber Text(30)
StartDate Text(15)
StartTime Text(10)
Duration Number(Decimal)
Value Currency
DestCode Text(10)
BNumber Text(30)
Dim ANumber As String
Dim BNumber As String
Dim DestCode As String
Dim StartDate As String
Dim StartTime As String
Dim DurMins As Single
Dim Value As Currency
Dim Comma As String
Dim DblQuote As String
Dim SglQuote As String
Comma = Chr(44)
DblQuote = Chr(34)
SglQuote = Chr(39)
The data is parsed from an input file and stored in the above variables
before creating the input string as below:
InsertString = "INSERT INTO Calldata " & _
"( ANumber, StartDate, StartTime, Duration, Value,
DestCode, BNumber) " & _
"values(" & DblQuote & ANumber & DblQuote & Comma & _
DblQuote & StartDate & DblQuote & Comma & _
DblQuote & StartTime & DblQuote & Comma & _
DurMins & Comma & _
SglQuote & Value & SglQuote & Comma & _
DblQuote & DestCode & DblQuote & Comma & _
DblQuote & BNumber & DblQuote & ");"
A debug.print of InsertString shows:
debug.Print InsertString
INSERT INTO Calldata ( ANumber, StartDate, StartTime, Duration, Value,
DestCode, BNumber) values("02077384851
","01-Aug-2006","08:20",50.83333,'0.506',"020867","02086786396");
I have tried the currency field both with and without the single quote but
all I am getting is a syntax error in the insert statement and I cannot see
where. Any help will be greatly appreciated.
Thanks
I need a second pair of eyes to glance over this statement because I cannot
spot the syntax error in it.
The data is being saved into a table called Calldata which has the following
field definitions:
ANumber Text(30)
StartDate Text(15)
StartTime Text(10)
Duration Number(Decimal)
Value Currency
DestCode Text(10)
BNumber Text(30)
Dim ANumber As String
Dim BNumber As String
Dim DestCode As String
Dim StartDate As String
Dim StartTime As String
Dim DurMins As Single
Dim Value As Currency
Dim Comma As String
Dim DblQuote As String
Dim SglQuote As String
Comma = Chr(44)
DblQuote = Chr(34)
SglQuote = Chr(39)
The data is parsed from an input file and stored in the above variables
before creating the input string as below:
InsertString = "INSERT INTO Calldata " & _
"( ANumber, StartDate, StartTime, Duration, Value,
DestCode, BNumber) " & _
"values(" & DblQuote & ANumber & DblQuote & Comma & _
DblQuote & StartDate & DblQuote & Comma & _
DblQuote & StartTime & DblQuote & Comma & _
DurMins & Comma & _
SglQuote & Value & SglQuote & Comma & _
DblQuote & DestCode & DblQuote & Comma & _
DblQuote & BNumber & DblQuote & ");"
A debug.print of InsertString shows:
debug.Print InsertString
INSERT INTO Calldata ( ANumber, StartDate, StartTime, Duration, Value,
DestCode, BNumber) values("02077384851
","01-Aug-2006","08:20",50.83333,'0.506',"020867","02086786396");
I have tried the currency field both with and without the single quote but
all I am getting is a syntax error in the insert statement and I cannot see
where. Any help will be greatly appreciated.
Thanks