?
Solved

field size

Posted on 1998-09-07
3
Medium Priority
?
220 Views
Last Modified: 2012-05-04

Why this is not running?
Notes:"art_descricao" is a field of the artigos table.

dim val

 MyFile = "C:\desenvolvimento\vbasic\winges\clientes.MDB"
Set MyWorkspace = Workspaces(0)
    Set MyDatabase = MyWorkspace.OpenDatabase(MyFile, False, False)
       Set MySet = MyDatabase.OpenRecordset("artigos", dbOpenDynaset)

--->>>> val = myset.fields("art_descricao").FieldSize ???????<<-----

msgbox (val)


thanks
0
Comment
Question by:asimoes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Expert Comment

by:DaveD072798
ID: 1433452
What type of field is "art_descricao"? FieldSize will only work on Long Binary and Memo fields. You use Size instead of FieldSize for anything else.
0
 
LVL 7

Expert Comment

by:tward
ID: 1433453
DaveD is correct, what is the error you are getting?

FieldSize Property

Returns the number of bytes used in the database (rather than in memory) of a Memo or Long Binary Field object in the Fields collection of a Recordset object.

Return Values

The return value is a Long that indicates the number of characters (for a Memo field) or the number of bytes (for a Long Binary field).

Remarks

You can use FieldSize with the AppendChunk and GetChunk methods to manipulate large fields.

Because the size of a Long Binary or Memo field can exceed 64K, you should assign the value returned by FieldSize to a variable large enough to store a Long variable.

To determine the size of a Field object other than Memo and Long Binary types, use the Size property.

Note In an ODBCDirect workspace, the FieldSize property is not available in the following situations:

If the database server or ODBC driver does not support server-side cursors.


If you are using the ODBC cursor library (that is, the DefaultCursorDriver property is set to dbUseODBC, or to dbUseDefault when the server does not support server-side cursors).


If you are using a cursorless query (that is, the DefaultCursorDriver property is set to dbUseNoCursor).
For example, Microsoft SQL Server version 4.21 does not support server-side cursors, so the FieldSize property is not available.

The FieldSize property and the VBA Len() or LenB() functions may return different values as the length of the same string. Strings are stored in a Microsoft Jet database in multi-byte character set (MBCS) form, but exposed through VBA in Unicode format. As a result, the Len() function will always return the number of characters, LenB will always return the number of characters X 2 (Unicode uses two bytes for each character), but FieldSize will return some value in between if the string has any MBCS characters. For example, given a string consisting of three normal characters and two MBCS characters, Len() will return 5, LenB() will return 10, and FieldSize will return 7, the sum of 1 for each normal character and 2 for each MBCS character.

0
 
LVL 2

Accepted Solution

by:
dabellei earned 100 total points
ID: 1433454
Like Daved said you should use the size instead of Fieldsize if your fields is not memo or long binary field. Also you can't use val = .....  val is a reserved word in VB.


0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question