Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 17-03-2009
Member
 
Join Date: Jan 2009
Posts: 91
Populating an Access 2003 list box with vb6

Hello friends,

I have a vb6 form and a ms access file that has stored in it a table.That table contains 3 columns(ID,Username, Password).
All i wanted was when the form loads i want that the access list should get populated.
Reply With Quote
  #2  
Old 17-03-2009
Member
 
Join Date: Dec 2008
Posts: 101
Re: Populating an Access 2003 list box with vb6

Sure i will help you out with this try to use the following code hope it will work for you.

HTML Code:
Private Sub Form_Load()
Dim rs As New ADODB.Recordset
Dim strConnectionString As String
Dim strSQL As String


On Error GoTo Handler:
strConnectionString = ""
strSQL = "select * from tblUsers"
    
rs.Open strSQL, strConnectionString
If Not (rs.EOF And rs.BOF) Then
    rs.MoveFirst
    Do While Not rs.EOF
        strID = rs.Fields(0).Value
        strName = rs.Fields(1).Value
        strPassword = rs.Fields(2).Value
        Call AddToListBox(strID, strName, strPassword)
        rs.MoveNext
    Loop
Else
    MsgBox "No records found."
End If

My_Exit_Sub:
On Error Resume Next
rs.Close
Set rs = Nothing
Exit Sub
Handler:
MsgBox "Error " & Err.Number & ": " & Err.Description
Resume My_Exit_Sub
End Sub

Private Sub AddToListBox(ByVal strID As String, ByVal strName As String, _
    ByVal strPassword As String)

    MsgBox "Code to add to list box executes now."

End Sub
Reply With Quote
  #3  
Old 17-03-2009
Member
 
Join Date: Jan 2009
Posts: 91
Re: Populating an Access 2003 list box with vb6

Thanks for replying me i try to use the code but it's not working with me and need for multicolumn listBox.
Reply With Quote
  #4  
Old 20-03-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: Populating an Access 2003 list box with vb6

Try to use this code i am sure it will work for you.


HTML Code:
Private Sub Command1_Click()

 List1.RowSource = ""

 List1.RowSourceType = "Value List"

 List1.ColumnCount = 3

 List1.ColumnWidths = "500;500;500"

 List1.AddItem "111;222;333"
 List1.AddItem "444;555;666"
End Sub

Intel Core 2 Duo 2.8 Ghz
G31 Asrock Motherboard with Intel chipset
1gb RAM
120gb HDD
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Populating an Access 2003 list box with vb6"
Thread Thread Starter Forum Replies Last Post
How can I make Calendar Auto-Populating in MS Excel Fitroy Windows Software 6 10-07-2011 11:13 AM
Read Access 2003 files with Access 2007 Kendal-J Windows Software 2 26-05-2010 05:57 PM
Populating sqlite database on iphone tecHAMMER Software Development 3 01-10-2009 10:48 AM
Is there a master list of Microsoft Windows Server 2003 services that will also list what the default startup type? Spin Windows Server Help 1 21-09-2008 09:05 AM
Remote Access and Outlook Web Access on SBS 2003 mannuraama Small Business Server 4 04-06-2008 04:22 AM


All times are GMT +5.5. The time now is 04:43 PM.