Microsoft Access Forums

Go Back   Microsoft Access Forums > Access Forums > Programming

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 06-05-2009, 07:24 AM
Patrick.Grant01 Patrick.Grant01 is offline Windows XP Access 2007 (version 12.0)
Novice
 
Join Date: May 2009
Posts: 23
Patrick.Grant01 is on a distinguished road
Default SQL Server/VBA Data Types - Long & BigInt

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
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -8. The time now is 02:57 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.