![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Greetings, The problem is with the ODBC connection. *With an ODBC connection to an Access MDB you will only get 255 chars per field max for Text (varchar) columns. *The rest of the characters get truncated. *The way to get around this limitation with ODBC is to retrieve the desired values using ADO (in VBA). *Go to Tools/References and make a reference to the highest version of "Microsoft ActiveX Data Objects 2.X Library" then, in a Standard Code module (or a Form code module) Sub GetLongString() Dim cmd As New ADODB.Command, RS As New ADODB.Recordset cmd.ActiveConnection = "Provider=SQLOLEDB; Data Source=yourServer;Database=yourDB;Trusted_Connecti on=Yes" cmd.ActiveConnection.CursorLocation = adUseClient cmd.CommandTimeout = 600 cmd.CommandType = adCmdText cmd.CommandText = "Select fldx from tblX Where something = 'something'" Set RS = cmd.Execute Debug.Print RS(0) cmd.ActiveConnection.Close End Sub Rich *** Sent via Developersdexhttp://www.developersdex.com*** |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
No. Whatever data you pass from Access to Excel will remain the same. The problem is that the automation code is reading the data from an ODBC table and the data is being truncated at the ODBC table. |
#6
| |||
| |||
|
|
Hello, I work on an app developped with Access/VBA and communicating with a SQL Server database via ODBC. My problem is that I have to manage a big string which can be 0 to 1024 characters long. The string is correctly stored in the Access and SQL Server tables (Memo field for Access, and varchar(1024) for SQL Server). I also need to write this string in an Excel report created by the application. For this purpose, I store the huge string in a variant VBA variable, but when looking at the variant with the debugger, I find that it has got only 255 characters (when the string is 1024 characters long). In the Excel report, I also get only the 255 first chars. Is this a normal behaviour ? I searched the internet but I didn't find information about the max string length that can be stored in a variant in VBA ? Thank you for your help. |
#7
| |||
| |||
|
|
nartla <bruno.bar... (AT) altran (DOT) com> wrote in news:0a098301-faf3-4ef8-be89-4e1f0dc0c2c4 @u10g2000prn.googlegroups.co m: Hello, I work on an app developped with Access/VBA and communicating with a SQL Server database via ODBC. My problem is that I have to manage a big string which can be 0 to 1024 characters long. The string is correctly stored in the Access and SQL Server tables (Memo field for Access, and varchar(1024) for SQL Server). I also need to write this string in an Excel report created by the application. For this purpose, I store the huge string in a variant VBA variable, but when looking at the variant with the debugger, I find that it has got only 255 characters (when the string is 1024 characters long). In the Excel report, I also get only the 255 first chars. Is this a normal behaviour ? I searched the internet but I didn't find information about the max string length that can be stored in a variant in VBA ? Thank you for your help. See the Microsoft Knowledgebase article athttp://support.microsoft.com/kb/208801 -- Bob Quintal PA is y I've altered my email address. -- Posted via a free Usenet account fromhttp://www.teranews.com- Masquer le texte des messages précédents - - Afficher le texte des messages précédents - |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |