Results 1 to 11 of 11

Thread: List problem

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    76

    List problem

    here i've got a problem i was just trying with my assesment so...
    here i was doing my problem using listview but actually i didn't get mush knowledge bout listview till then i wanna just get u alls help...i've got to option button using control array so i was to display when i click on option buttons so here is my code with error ya so just plezz help me ya...
    again when i compile the program error comes like this ...Operation is not allowed when the object is open c this also plezzz...

    VB Code:
    1. Private Sub optSelect_Click(Index As Integer)
    2.     Dim TItem As ListItem
    3.    
    4.     Call data_connection
    5.    
    6.     strSQL = ""
    7.     strSQL = "SELECT * FROM tblCustomer"
    8.    
    9.     Set rsLv = gconn.Execute(strSQL)
    10.    
    11.     'rsLv.Open strSQL, gconn, adOpenKeyset, adLockOptimistic, adCmdText
    12.    
    13.     Select Case Index
    14.  
    15.         Case 0
    16.             MsgBox rsLv("fldFirstName")
    17.             While Not rsLv.EOF
    18.                 Set TItem = lvwCust.ListItems.Add(, , rsLv("fldFirstName") & " " & _
    19.                     rsLv("fldFamilyName"))
    20.                     rsLv.MoveNext
    21.  
    22.              Wend
    23.  
    24.         Case 1
    25.             MsgBox rsLv("fldSuburb")
    26.             Do Until rsLv.EOF
    27.                 'Set TItem = lvwCust.ListItems.Add(, , rsLv("fldSuburb"))
    28.                             Set TItem = lvwCust.ListItems.Add(, , rsLv("fldFirstName") & " " & _
    29.                 rsLv("fldFamilyName") & " ( " & rsLv("fldSuburb") & ")")
    30.                 rsLv.MoveNext
    31.  
    32.             Loop
    33.  
    34.     End Select
    35.    
    36.        
    37.            
    38. End Sub
    Last edited by Hack; Dec 20th, 2005 at 06:43 AM.

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: List problem

    Why did you comment out the OPEN statement? That's what's closed.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    76

    Re: List problem

    u mean which one please i tried as u say but not getting any thing ya just again coming that error please if u don't mind give bit in detail ya i'm not getting n e thing ya...
    till then thnx for ur help ya

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: List problem

    I hope that the data_connection opens the connection.

    VB Code:
    1. strSQL = ""
    2. strSQL = "SELECT * FROM tblCustomer"
    3. Set rsLv = gconn.Execute(strSQL)
    4. rsLv.Open strSQL, gconn, adOpenKeyset, adLockOptimistic, adCmdText

    not sure exactly how you are doing this though.

  5. #5
    Frenzied Member
    Join Date
    May 2003
    Location
    Sydney
    Posts
    1,123

    Re: List problem

    i think i see the problem here. the piece of code itself has no problems. the problem is in the procedure call data_connection IF, it contains certain things like provider definitions, open main connections etc....

  6. #6
    Frenzied Member
    Join Date
    May 2003
    Location
    Sydney
    Posts
    1,123

    Re: List problem

    david, once u do the set rslv=gconn.execute, u dont need to open it again. as u can see in the red at the first post, the problem comes coz he's supposedly trying to change connection parameters while the connection is open.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    76

    Re: List problem

    thnx for ur kindness ya but i mean to say that ya i did it as u said but some problems comes. but here my problem is like this that i've two option buttons i was to display when i click on that particular option buttons but when i click on that particular option buttons doen't displays any thing using listview so now plezzz i hope u might've got my problem now ya...so plezz help me out ya...

    my code here...

    VB Code:
    1. Private Sub optSelect_Click(Index As Integer)
    2.     Dim TItem As ListItem
    3.    
    4.     Call data_connection
    5.    
    6.     strSQL = ""
    7.     strSQL = "SELECT * FROM tblCustomer"
    8.    
    9.     Set rsLv = gconn.Execute(strSQL)
    10.    
    11.    
    12.     'Here using control array to display the particular customer names when clicked
    13.     Select Case Index
    14.        
    15.         'to display on the first listview
    16.         Case 0
    17.             While Not rsLv.EOF
    18.                
    19.                 Set TItem = lvwCust.ListItems.Add(, , rsLv("fldFirstName") & " " & _
    20.                     rsLv("fldFamilyName"))
    21.                     rsLv.MoveNext
    22.  
    23.              Wend
    24.        
    25.         'to display on second listview
    26.         Case 1
    27.             Do Until rsLv.EOF
    28.                
    29.                             Set TItem = lvwCust.ListItems.Add(, , rsLv("fldFirstName") & " " & _
    30.                 rsLv("fldFamilyName") & " ( " & rsLv("fldSuburb") & ")")
    31.                 rsLv.MoveNext
    32.  
    33.             Loop
    34.  
    35.     End Select
    36.    
    37.        
    38.            
    39. End Sub

    so help me plezz...if don't get me sure to clearfy ya...

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: List problem

    Try
    VB Code:
    1. Set TItem = lvwCust.ListItems.Add(, , rsLv("fldFirstName")
    2.      TItem.Subitems(1) = rsLv("fldFamilyName")

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    76

    Re: List problem

    Thnx mr.Hack that is fine it is working all fine but the thing is that i was to display when i click on option button as i've stated as before u just have a look at my code once again ya.
    thnx any ways all the helpers

  10. #10
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: List problem

    Quote Originally Posted by kaylu_mo
    Thnx mr.Hack that is fine it is working all fine but the thing is that i was to display when i click on option button as i've stated as before u just have a look at my code once again ya.
    thnx any ways all the helpers
    I don't understand.

    You have two option buttons, or that is what it appears to be, and based on which is selected, you want to display the first row, and then, depending on what is selected, either the second and third row or just the second.

    What are you having a problem with?

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Posts
    76

    Re: List problem

    yes i've two option buttons n i was to display when i click on the option buttons but the problem is when i click on which ever the option buttons their doen't displays any thing i tired in any way but its not working.the code is as stated as above ..
    so that is the problem.
    thnx
    kaylu_mo

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