Solved

field size

Posted on 1998-09-07
3
212 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 50 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

733 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