Hi,
I'm trying to use a dbcombo box as a driver for my form. With alot of help from Woyler I got everything setup but now I have another problem.
When I get to the line that opens the recordset (rs.open) I get the following error: command text not set for the command object.
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
sMyCriteria = DBCombo1.Text
sSQL = "SELECT * FROM EMPLOYEES WHERE [name]='" & sMyCriteria & "'"
Text1.Text = rs("Name"
Text2.Text = rs("Title"
Text3.Text = rs("Department"
rs.Close
Set rs = Nothing
End Sub
Thanks for the help..Russ
I'm trying to use a dbcombo box as a driver for my form. With alot of help from Woyler I got everything setup but now I have another problem.
When I get to the line that opens the recordset (rs.open) I get the following error: command text not set for the command object.
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
sMyCriteria = DBCombo1.Text
sSQL = "SELECT * FROM EMPLOYEES WHERE [name]='" & sMyCriteria & "'"
Text1.Text = rs("Name"
Text2.Text = rs("Title"
Text3.Text = rs("Department"
rs.Close
Set rs = Nothing
End Sub
Thanks for the help..Russ