Consulting

Results 1 to 6 of 6

Thread: Solved: Searh and edit record from listbox

  1. #1
    VBAX Contributor
    Joined
    Sep 2007
    Posts
    119
    Location

    Solved: Searh and edit record from listbox

    Hi there,

    I used the code from forum for editi of database on selected record through display in listbox after search event.

    The problem is when select the record for edit, return error as "Could not get the list property. Invalid property array index" The search type can be any item in the sheets("ALLSSE").


    Can anybody help me out ?

    Thanks

    workbook attached

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I have just run it and it works fine for me.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Tutor nst1107's Avatar
    Joined
    Nov 2008
    Location
    Monticello
    Posts
    245
    Location
    You get your error here:[VBA] .Tbname.Value = FrmMain.ListBox1.List(ListIndex + 1, 2)
    [/VBA]
    The problem is you are using ListIndex as a Variant and haven't given it a value. I think ListBox1.ListIndex is what you're looking for.

  4. #4
    VBAX Tutor nst1107's Avatar
    Joined
    Nov 2008
    Location
    Monticello
    Posts
    245
    Location
    Actually, that won't work, either. ListBox1 also needs an object qualifier. And the List and ListIndex properties both use base 0, so adding 1 to the ListIndex won't get you the entry you want and can cause errors as well. This works:[VBA] .Tbname.Value = FrmMain.ListBox1.List(FrmMain.ListBox1.ListIndex, 2)
    [/VBA]

  5. #5
    VBAX Contributor
    Joined
    Sep 2007
    Posts
    119
    Location
    Yes,It works and solved my problem.

    Thanks nst1107 solution came to my recue.

  6. #6
    Superb response

Posting Permissions

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