G
Guest
Hi,
I tried to write codes to let users add new customer names to a predesigned
list (tblCustomerList, field: Customer Name), but I keep on getting an error
saying "Run-time error '-2147217900(80040e14)' Syntax error in INSERT INTO
statement from the following code:
Private Sub CboCustomerName_NotInList(NewData As String, _
Response As Integer)
Dim new_data As String
Dim conn As ADODB.Connection
Set conn = CurrentProject.Connection
'double up any apostrophes before Insert
new_data = Replace(NewData, "'", "''")
Response = acDataErrAdded
conn.Execute "Insert Into " & _
"tblCustomerList(Customer Name) Values('" & _
new_data & "')"
End Sub
I'm not sure why it's not working........
I tried to write codes to let users add new customer names to a predesigned
list (tblCustomerList, field: Customer Name), but I keep on getting an error
saying "Run-time error '-2147217900(80040e14)' Syntax error in INSERT INTO
statement from the following code:
Private Sub CboCustomerName_NotInList(NewData As String, _
Response As Integer)
Dim new_data As String
Dim conn As ADODB.Connection
Set conn = CurrentProject.Connection
'double up any apostrophes before Insert
new_data = Replace(NewData, "'", "''")
Response = acDataErrAdded
conn.Execute "Insert Into " & _
"tblCustomerList(Customer Name) Values('" & _
new_data & "')"
End Sub
I'm not sure why it's not working........