CarlRostron
New Member
- Joined
- May 11, 2011
- Messages
- 26
I have submitted problem 1 and this appears to be a similar issue (maybe the same I don't know) but I get a different error message from a different part of my code.
Again I am trying to add some data from Excel to Access but this time I receive an error message:
"Operation must use an updateable query" but I have tried the same text string in Access as a Query using the Query Builder and it has no issues at all.
This is the text string:
UPDATE tblSymbol SET tblSymbol.Beta = 1.6047 WHERE (((tblSymbol.SymbolCode)="LYB"));
Here is the code that runs this:
Again I am trying to add some data from Excel to Access but this time I receive an error message:
"Operation must use an updateable query" but I have tried the same text string in Access as a Query using the Query Builder and it has no issues at all.
This is the text string:
UPDATE tblSymbol SET tblSymbol.Beta = 1.6047 WHERE (((tblSymbol.SymbolCode)="LYB"));
Here is the code that runs this:
Code:
Sub AddBetaToDB()
On Error GoTo Err:
Dim cn As ADODB.connection
Dim Answer As String
Dim sql
Dim Exists As Integer
Dim counter As Integer
Set cn = New ADODB.connection
cn.connectionString = "Provider = Microsoft.ACE.OLEDB.12.0;Data Source = " & DBPath & ";Persist Security Info=False;"
cn.Open
sql = "UPDATE tblSymbol SET tblSymbol.Beta = " & Round(Range("BetaValue").Value, 4) & " " & _
"WHERE (((tblSymbol.SymbolCode)='" & symbol & "'));"
'MsgBox sql
cn.Execute sql ('FAILS AT THIS LINE)
cn.Close
Set cn = Nothing
Exit Sub
Err:
MsgBox Err.Description
Exit Sub
End Sub