I have the follow SQL code for CREATE TABLE.
Code:
SQL = "CREATE TABLE " & TableName & " ([Ticker] VARCHAR, [Name] VARCHAR, [Exchange] VARCHAR, PRIMARY KEY (Ticker));"
On Error Resume Next
Call UpdateDatabaseData(SQL) 'this is supposed to generate an error if table already exists, it is not supposed to overwrite and existing table
On Error GoTo 0
Sub UpdateDatabaseData(SQL As String)
With CN
.Execute (SQL)
End With
End Sub
It is designed to generate an error if the table already exists with the error handling making the program continue on. I use this code in many programs and it works fine.
But there is one program where it does not generate an error BUT INSTEAD it overwrites the existing table.
Can anyone think of the reason why this might be happening? I have reviewed the code over and over again and it is identical. Is there something going on "under the hood" that I need to change to get this to not overwrite?
Thank you.