+ Reply to Thread
Results 1 to 11 of 11

Column Property error

  1. #1
    Forum Contributor
    Join Date
    09-29-2014
    Location
    Montreal, Canada
    MS-Off Ver
    2013
    Posts
    222

    Column Property error

    When I run the following code I get on the line Me.txtID.Value = Me.ListBox21.Column(14) the error "Could not get the column property. Invalid argument". I have copied this code from a lesson I follow and revised to my needs. When I click to run, it copies the records to 15 text boxes I have on my userform and it works but then I get the error message. I have disabled all error lines so I can see where the error occurs. Where should I look for the column property?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Column Property error

    I believe if you have 14 columns then they are numbered 0 to 13? This would explain why it errors on column 14
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Contributor
    Join Date
    09-29-2014
    Location
    Montreal, Canada
    MS-Off Ver
    2013
    Posts
    222

    Re: Column Property error

    Thanks for the help, I have 15 columns in my DB and 15 textboxes to get the data into. The code count starts at zero that's why the last line is 14 (14 plus the 0 value of the first txtLastName.Value gives total count of 15). Perhaps I'm wrong?

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Column Property error

    You are correct... any chance you can upload the file with the problem?

  5. #5
    Forum Contributor
    Join Date
    09-29-2014
    Location
    Montreal, Canada
    MS-Off Ver
    2013
    Posts
    222

    Re: Column Property error

    Sure, here is the file but please note there are other problems in this file, its work in progress lol
    Attached Files Attached Files

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Column Property error

    Ok well checking the listbox in your file... it has 14 columns....
    1. Lastname
    2. Firstname
    3. Company
    4. Title
    5. Work
    6. Home
    7. Fax
    8. Mobile
    9. Email
    10. Address
    11. City
    12. State
    13. Zip
    14. Comments
    Those numbers are the count... the column numbers are one lower of course.

  7. #7
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Column Property error

    Quote Originally Posted by oskar44 View Post
    Sure, here is the file but please note there are other problems in this file, its work in progress lol
    Your problem is the row source property for your list box doesn't include the column with ID.

    You row source is:
    MyDB!$T$9:$AG$152

    It should be:
    MyDB!$T$9:$AH$152

    You also need to set your column count to 15 if you want to see the ID information in your list. Maybe you didn't want to see it and that's why you had it set to 14, but your problem is your row source only covers 14 columns.

  8. #8
    Forum Contributor
    Join Date
    09-29-2014
    Location
    Montreal, Canada
    MS-Off Ver
    2013
    Posts
    222

    Re: Column Property error

    Excellent observation skywriter, thanks

  9. #9
    Forum Contributor
    Join Date
    09-29-2014
    Location
    Montreal, Canada
    MS-Off Ver
    2013
    Posts
    222

    Re: Column Property error

    Sorry, forgot to say thanks to all for the help

  10. #10
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Column Property error

    Quote Originally Posted by oskar44 View Post
    Excellent observation skywriter, thanks
    Arkadi made it easy to figure out.

    If you are happy with those who have helped you, please consider clicking the add reputation button in the lower left hand corner of where they have replied to your request for help.

  11. #11
    Forum Contributor
    Join Date
    09-29-2014
    Location
    Montreal, Canada
    MS-Off Ver
    2013
    Posts
    222

    Re: Column Property error

    lol, easy for you but not for me

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Runtime error 381: Could not set the list property.Invalid property array index
    By rohith4prithvi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2014, 10:24 PM
  2. Error! Could not get the column property, Invalid argumnet
    By z-eighty2 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-10-2014, 09:00 AM
  3. Could not get the column property, Invalid argumnet Error? Plz Help
    By z-eighty2 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-04-2014, 06:32 PM
  4. [SOLVED] Excel run-time error '381': Could not set the List property. Invalid property array index
    By eemiller1997 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-20-2012, 12:48 PM
  5. Replies: 2
    Last Post: 06-11-2012, 03:03 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1