Results 1 to 3 of 3

Thread: what is wrong in this code?

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2002
    Location
    SAUDI ARABIA
    Posts
    53

    what is wrong in this code?

    i am useing class and i write this code

    '*************************
    Public Sub HOSPLIST(FRM As Form,list as object)
    FRM.List.Clear
    Set Rs2 = New Recordset
    Set Rs2 = cn.Execute("SELECT * FROM HOSPT")
    Do Until Rs2.EOF
    FRM.List.AddItem Rs2("HOSPNAME")
    Rs2.MoveNext
    Loop
    Rs2.Close
    Set Rs2 = Nothing
    End Sub
    '***************************
    'where list is combobox or listbox
    never i can not say 'NO' for u until u aske me to leave u...

  2. #2
    Hyperactive Member Anglo Saxon's Avatar
    Join Date
    Mar 2002
    Location
    Durham, UK
    Posts
    259
    You dont need to reference the form :

    Code:
    Public Sub HOSPLIST(FRM As Form,list as object) 
    list.Clear 
    Set Rs2 = New Recordset 
    Set Rs2 = cn.Execute("SELECT * FROM HOSPT") 
    Do Until Rs2.EOF 
    list.AddItem Rs2("HOSPNAME") 
    Rs2.MoveNext 
    Loop 
    Rs2.Close 
    Set Rs2 = Nothing 
    End Sub
    By the way , it would also help a lot if you actually told us what error you were getting or tried to explain what was going wrong!


    ---
    Anglo saxon

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2002
    Location
    SAUDI ARABIA
    Posts
    53
    many thanks Anglo saxon
    it is ok.....
    never i can not say 'NO' for u until u aske me to leave u...

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