Results 1 to 2 of 2

Thread: retrieving length's of columns in a database?

  1. #1

    Thread Starter
    Registered User
    Join Date
    Jul 2000
    Posts
    52

    retrieving length's of columns in a database?

    I have an access database with a pair of tables. I know how many fields are in the table (42 and 36). I want to load, using an array, the field lengths of each field into an array. Why doesn't the following work? It gives me a -1 for each element in the array instead of the numeric length of the field. Here is what I have:
    VB Code:
    1. For i = 0 To 42
    2.             tcrhdrfldlen(i) = tcrhdrdt.Columns(i).MaxLength
    3.         Next i
    4.  
    5.         For i = 0 To 36
    6.             tcrdtrfldlen(i) = tcrdtrdt.Columns(i).MaxLength
    7.         Next i

    Here is what worked in VB5:
    VB Code:
    1. For i = 0 To 42
    2.             tcrhdrfldlen(i) = tcrhdrdt.Fields(i).Size
    3.         Next i
    4.  
    5.         For i = 0 To 36
    6.             tcrdtrfldlen(i) = tcrdtrdt.Fields(i).Size
    7.         Next i

    Thanks for the help!

  2. #2

    Thread Starter
    Registered User
    Join Date
    Jul 2000
    Posts
    52
    Any ideas on this? I can't find any properties that would possibly tell me this. In the help, it said that a -1 means that there is not maxlength, so which property do I need to reference? Thanks!

    shootsnlad

Posting Permissions

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



Click Here to Expand Forum to Full Width