Programing in Visual Basic

R

Robert Couchman

Hello all,

please can someone help?

i have a form created in Visual Basic 6.0, what i need the
button on the form to do is..

link to a access file (newresults) then run a query...

this is an even harder bit!!!

the query is determined by what is selected from a
combobox on the page, and also a textbox
(for example combobox = student and textbox = Bob, this
will then query under attribute 'student' for any records
containing 'Bob')

if anyone has a clue of how to do this, or even how to
break this down, it will be very appriciated (deadline is
thursday!!)

thank you,

Robert Couchman
 
M

Michel Walsh

Hi,


Open an ADO connection, xnn, then execute the appropriate query. Since
you did not mention WHAT you retrieve....

Dim str As Sting
Dim rst As ADODB.Recordset
str="SELECT what FROM tableName WHERE " & _
Me.ComboBoxName.Text & "=""" & Me.TextControl & """"
' Debug.Print str
Set rst=xnn.Execute( str )



and the data is in the recordset rst (read only, forward only).



Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top