CarlRostron
Registered User.
- Local time
- Today, 16:33
- Joined
- Nov 14, 2011
- Messages
- 88
trtying to query the Symbol table to see if a recod exists with symbol code.
I am querying the tblSymbol table from Excelk vba and the Access DB is on my machine.
The code I am using is:
MsgBox Exists always returns -1 but i know the code exists in the table.
I am querying the tblSymbol table from Excelk vba and the Access DB is on my machine.
The code I am using is:
Code:
Set rs = New ADODB.Recordset
rs.Open "tblSymbol", cn, adOpenKeyset, adLockOptimistic, adCmdTable
Set rs2 = New ADODB.Recordset
sql = "SELECT * FROM [tblSymbol] WHERE [SymbolCode] = """ & someSymbol & """"
rs2.Open sql, cn, adOpenDynamic, adLockOptimistic
Exists = rs2.RecordCount
MsgBox Exists
MsgBox sql
If (rs2.RecordCount >= 0) Then
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
rs2.Close
Set rs2 = Nothing
Exit Sub
End If
MsgBox Exists always returns -1 but i know the code exists in the table.