CarlRostron
New Member
- Joined
- May 11, 2011
- Messages
- 26
I recently upgraded to office 2013 and my code has since stopped working so wondered if anyone could help me please?
I am simply trying to add data to an Access table using the rs.AddNew method.
Below is some of the code.
I am simply trying to add data to an Access table using the rs.AddNew method.
Below is some of the code.
Code:
Sub AddSymbol(someSymbol As String)
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim rs2 As ADODB.Recordset
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 = " & DB_LOCATION
cn.Open
Set rs = New ADODB.Recordset
rs.Open "tblSymbol", cn, adOpenDynamic, adLockOptimistic, adCmdTable
rs.AddNew (--CODE FAILS AT THIS LINE--)
rs.Fields("SymbolName") = ActiveCell.Value
rs.Fields("SymbolCode") = ActiveCell.Offset(0, 1).Value
rs.Fields("AssetClassID") = 1
rs.Fields("CurrencyID") = 64
rs.Fields("ExchangeID") = 129
rs.Fields("MonthID") = 11
rs.Fields("DateAdded") = Date
rs.Fields("IndustryID") = 7444
rs.Update