fill listbox from recordset

ingrid

Registered User.
Local time
Today, 16:54
Joined
Apr 10, 2003
Messages
42
I want to fill a listbox with results from a recordset.

I used to fill it with
listbox.rowsource = "SELECT veld FROM tabel".
That works fine but now I have to retrieve data from another database.

How do I tell the listbox to connect to the other database?
I allready have this;
Set ws = CreateWorkspace("ODBCwerkruimte", "", "", dbUseODBC)
Set Conn = ws.OpenConnection("SenP", dbDriverNoPrompt, False, "ODBC;DATABASE=SenP;UID=;PWD=;DSN=SQLSenP")
Set Rst = Conn.OpenRecordset(SQL, dbOpenDynamic, , 1)

The problem is now to get the results into the listbox.
 
Why don't you link a table to the other database and then build the listbox's RowSource on a query of that table?
 
Because I didn't think about it :).
Does this answer mean that what I want isn't possible?
 
ingrid said:
Does this answer mean that what I want isn't possible?

I'd say so. I use listboxes a lot on my databases and typically, the RowSource is set to a table, a query, or a string variable that holds a basic SQL query. Recordset objects, you can't do. You are wanting to assign a Recordset object to a RowSource.
 

Users who are viewing this thread

Back
Top Bottom