sdruley
Well-known Member
- Joined
- Oct 3, 2010
- Messages
- 557
- Office Version
- 365
- Platform
- Windows
In the following,there is just one line of code I can't get right. Any ideas on this? I am trying to take a text string and upload it from my computer to an external server.
The error message is [Microsoft][ODBC Drive Manager] Data source name not found and no default driver specified
The error message is [Microsoft][ODBC Drive Manager] Data source name not found and no default driver specified
Code:
If Range("upload") Then
aa = Application.Range("GH14").Value
bb = Format(Range("TOE"), "mm/dd/yyyy")
cc = Format(Range("TOE"), "h:mm:ss")
dd = Range("ver").Value
InsertData aa, bb, cc, dd
End If
Code:
Sub InsertData(ByVal strFirst As String, ByVal strSecond As String, ByVal strThird As String, ByVal strFourth As String)
Dim conn As New ADODB.Connection
Dim sql As String
Set conn = New ADODB.Connection
conn.Open "DFRSRainbow" ' THIS LINE OF CODE IS NOT RIGHT
' delete table contents
sql = "DELETE FROM tradingdata;"
conn.Execute sql
' write new entries using passed arguments
sql = "insert into tradingdata (first,second,third,fourth) values ('" & strFirst & "','" & strSecond & "','" & strThird & "','" & strFourth & "');"
conn.Execute sql
' clean up
conn.Close
Set conn = Nothing
End Sub
Last edited: