Is there a way to make a databound combo box the driver instead of an adodc control? I want to present a list to be selected from then have textboxes updated with there respective field info.
When you type: "dim cn as" then hit the spacebar, VB intelisense should pop up. Do you see "ADODB" as an option? If you do, select it, then '.' then connection.
And you are sure that you are going to the project menu, selecting references, and checking Microsoft ActiveX data objects 2.x and hitting the OK button?
you have to set up your connection string so that your VB app can connect to and 'talk' to your database. What kind of database are you going to use(access, oracle,sqlserver)?
'where it says TypeYourPathHere, enter the path to
'your database. ie: C:\MyStuff\MyAccess.mdb
cn.connectionstring = "Driver={Microsoft Access Driver (*.mdb)};Dbq=TypeYourPathHere;Uid=Admin;Pwd=;"
Private Sub DBCombo1_Click(Area As Integer)
Dim sMyCriteria As String
Dim sSQL As String
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sDatabasePath As String
Set cn = CreateObject("adodb.connection"
Set rs = CreateObject("adodb.recordset"
cn.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};Dbq=f:\db1.mdb;Uid=Admin;Pwd=;"
cn.Open
rs.Open sSQL, cn, adOpenDynamic, adLockOptimistic, adCmdText And adExecuteNoRecords
This is where we are.
command text not set for the command object.
Again I really appreciate your help and patient.
whether we get this or not you will get my vote.
sMyCriteria = DBCombo1.Text
sSQL = "SELECT * FROM EMPLOYEES WHERE FIELD='" & sMyCriteria & "'"
Text1.Text = rs("Name"
Text2.Text = rs("Title"
Text3.Text = rs("Department"
rs.Close
Set rs = Nothing
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.