i'm currently working on my Form in VB6. it has a list box that i use to display table. How do i display table from a different database?

i did it before by modifying row source property in VBA, but that only works if the form is part of that database application.

WaferSortRowSource = "SELECT [ABP/FET Wafer Sort].[D/C], [ABP/FET Wafer Sort].[P/N]," & _
                        "[ABP/FET Wafer Sort].Process," & _
                        " [ABP/FET Wafer Sort].[" & ColumnNo(1) & _
                        "], [ABP/FET Wafer Sort].[" & ColumnNo(2) & _
                        "], [ABP/FET Wafer Sort].[" & ColumnNo(3) & _
                        "], [ABP/FET Wafer Sort].[" & ColumnNo(4) & _
                        "], [ABP/FET Wafer Sort].[" & ColumnNo(5) & _
                        "] FROM [ABP/FET Wafer Sort] ; "
WaferSort.RowSource = WaferSortRowSource

but now i want to use a ListBox in a VB6 application instead, which i tried but the listbox remained empty.

this function i use in my VB6 program to open the VBA database application

Function OpenConnection()
conConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
conConnection.CursorLocation = adUseClient
End Function

with this i can read the values that reside in the tables. but how do i display the tables in the form of listbox instead? what should i put in RowSource property of the listbox?

thanks in advance

I think a listbox is a bit more difficult to work with.... If I'm not mistaken, you'll have to do it all manually, such as using the "additem" property of the listbox..... you can use the sendmessage API call to force the listbox to use columns and keep the data orderly, but I think a listview would suite your needs better.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.