![]() |
|
|
#1
|
|||
|
|||
|
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 |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Field Types for a Linked Table | Jeff_J | Access | 9 | 05-05-2009 05:12 AM |
Make Long Integer Field Size show 2.5 Billion
|
BigBear | Access | 3 | 04-12-2009 03:11 PM |
| Possible to store user-defined types in table? | Binky | Programming | 0 | 11-20-2008 11:28 AM |
| how long as this been around for.? | SOniC | Access | 0 | 04-12-2007 09:38 PM |
| Corruption problem Access 2000 - long, but please read | allochthonous | Access | 1 | 05-14-2006 07:01 AM |