Results 1 to 5 of 5
  1. #1
    Join Date
    May 2003
    Location
    Costa Rica
    Posts
    40

    Unhappy Unanswered: Maximum Size of a Field or Actualsize

    Hi people: First of all, this forum is excellent, really excellent. I have a question. It seems to be easy but I don´t know how to solve it.

    I have a table named PATROL. It has different fields: Name, First Name, etc. I defined the field Name as Text with 50 characters and First Name also as Text with 50 characters. After the table is filled out, I would like to know how many characters has the longer field of Name and the longer field of First Name in order to reduce space declared. For example:
    Names registered: Indiana, John,
    First Names registered: Jones, Broadway.
    Ok. The longer name is Indiana with 7 characters. The longer first name is Broadway with 8 characters. Using visual Basic for access using a module or a query, how can I obtein the lenght of the longer field for each field. Thank you very much.
    I have read about actualsize but it gives me an error. How about creating a module the incorporates a new field that evaluates the size of the field name, and then make a query that gives me the max value. Even I don´t know how to do it. Can you help me?.

  2. #2
    Join Date
    Sep 2003
    Posts
    228

    Re: Maximum Size of a Field or Actualsize

    Originally posted by Manuel Gimenez
    Hi people: First of all, this forum is excellent, really excellent. I have a question. It seems to be easy but I don´t know how to solve it.

    I have a table named PATROL. It has different fields: Name, First Name, etc. I defined the field Name as Text with 50 characters and First Name also as Text with 50 characters. After the table is filled out, I would like to know how many characters has the longer field of Name and the longer field of First Name in order to reduce space declared. For example:
    Names registered: Indiana, John,
    First Names registered: Jones, Broadway.
    Ok. The longer name is Indiana with 7 characters. The longer first name is Broadway with 8 characters. Using visual Basic for access using a module or a query, how can I obtein the lenght of the longer field for each field. Thank you very much.
    I have read about actualsize but it gives me an error. How about creating a module the incorporates a new field that evaluates the size of the field name, and then make a query that gives me the max value. Even I don´t know how to do it. Can you help me?.
    Off the top of my head (I'm new so I'm not too familiar with all the properties and such)... I would use some vb code and loop through the names storing Len(name) if it's greater than the biggest you've found so far.

    IMO disk space is cheap... leave it alone. If you do decided to change the size of the name fields to save space. Record the size of your DB before and after the change so you can see the difference in size. Post your results so we can all see.

    You could even switch them both to 10 now and see how much space that saves you.

    I don't think you can change the size of a field in table on the fly though. You have to change that manually.

  3. #3
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    Manuel:

    Pienso que la funcion Len te puede ser util combinada con algo de programacion.Sintaxis

    Len(cadena | nombrevar)

    La sintaxis de la función Len consta de las siguientes partes:

    Parte Descripción
    cadena Cualquier expresión de cadena válida. Si cadena contiene Null, se devuelve Null.
    Nombrevar Cualquier nombre de variable válido. Si nombrevar contiene Null, se devuelve Null. Si nombrevar es un tipo Variant, Len actúa igual que con un tipo String y siempre devuelve el número de caracteres que contiene.
    Comentarios

    Se deben especificar uno (y sólo uno) de los dos argumentos posibles. Con tipos de datos definidos por el usuario, Len devuelve el tamaño como se escribirá en el archivo.

    Nota Utilice la función LenB con datos de byte incluidos en una cadena. En lugar de devolver el número de caracteres en una cadena, LenB devuelve el número de bytes utilizados para representar esa cadena. Con tipos de datos definidos por el usuario, LenB devuelve el tamaño en memoria, incluyendo cualquier relleno entre los elementos.

    Nota Puede que Len no sea capaz de determinar el número real requerido de bytes de almacenamiento cuando se utiliza con cadenas de longitud variable en tipos de datos definidos por el usuario.

    Saludos Norberto
    Saludos
    Norberto

  4. #4
    Join Date
    Oct 2003
    Posts
    706

    Re: Maximum Size of a Field or Actualsize

    [i]
    I have a table named PATROL. It has different fields: Name, First Name, etc. I defined the field Name as Text with 50 characters and First Name also as Text with 50 characters. After the table is filled out, I would like to know how many characters has the longer field of Name and the longer field of First Name in order to reduce space declared...
    Don't worry about it. Declare them all as 255 (the maximum allowed) and Be Happy. A field declared as 255 takes no more space than one declared as 50. And even if it does, unless you are seriously worried about bumping into that 2- or 4-gigabyte "limit" with your data, Why Worry? You've got better things to worry about and the best that you can hope for is to cause trouble for yourself down the road.
    ChimneySweep(R): fast, automatic
    table repair at a click of the
    mouse! http://www.sundialservices.com

  5. #5
    Join Date
    Oct 2003
    Location
    Canada
    Posts
    574
    You could simply use a query instead:

    Select max(len(FirstName)) from Patrol;

    do the same for LastName. I don't remember what happens when you try to put both in the same query, but if you just want to know, run 2 separate queries.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •