I am trying to get an ADODB record set working with a SQL server 2005 database using an ODBC connection. The code is below. The select statement fails with a Data Type mismatch error 2147257913. I think its something to do with Long in VBA does not work with a BigInt in SQL Server The SQL fails in Query Builder with the same message. If I use the SQL in SQLServer direct it works. (SELECT * FROM tblInvestment Where SharescopeId =53321). What do I need to do to get it to run in Access?
================================================


Dim strSQL As String

Set rstCheckInvestment = New ADODB.Recordset
Set rstCheckInvestment.ActiveConnection = CurrentProject.Connection
rstCheckInvestment.CursorType = adOpenKeyset
rstCheckInvestment.LockType = adLockOptimistic
strSQL = "SELECT * FROM tblInvestment Where SharescopeId =" & ExternalKey
rstCheckInvestment.Source = strSQL
'rstAll.Open Options:=adCmdTable
rstCheckInvestment.Open

If Not rstCheckInvestment.BOF And Not rstCheckInvestment.EOF Then
CheckInvestmentExists = True
Else
CheckInvestmentExists = False
End If