All you need is the following
option explicit
Dim oConnection as adodb.connection
Private function GetConnection as Boolean
dim bconnected as boolean
set oConnection = new adodb.connection
with oconnection
.connectionstring = "the connection string for your database"
.open
end with
'Check if the connection opened correctly
if oConnection.state = adstateopen then
bConnected = true
else
bconnected = false
end if
getconnection = bconnected
end function
'This is the part that does the work
Private sub ExecuteSQL()
dim oRs as adodb.recordset
'Establish your connection and test it
if getconnection = true then
'Create the recordset
set oRs new adodb.recordset
'The executes the SQL against the connection and populates the recordset
with oRS
.activeconnection = oconnection
.source = text1.text 'The SQL source textbox
.open
end with
'populate the other textbox
'This will loop until the end of the recordset
while not oRS.eof
text2.text = oRS.fields("Field_Name"

.value
wend
I hope this gives you a good starting point if you need more info then leave a comment