Programing in Visual Basic

  • Thread starter Thread starter Robert Couchman
  • Start date Start date
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
 
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
 
Back
Top