Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() The code in example #1 works fine, but I am trying to figure out what is wrong with the code in example #2. I get an error when I try to open the recordset. I am trying to pass a value from a combo box to the query in example #2 so the user can select different values. I can't get it to work, I am looking for help. example #1 Dim sSql as String Dim i as Integer Dim cn as ADODB.Connection, rs as ADODB.Recordset, r AS Long, c ASLong Set cn = New ADODB.Connection cn.Open "Provider=Microsoft.Jet.Oledb.4.0; " & _ "Data Source=C:\DoctorBlades.mdb;" Set rs = New ADODB.Recordset rs.Open "tblDoctorBladesQuery",cn,adOpenDynamic,adLockOpti mistic example #2 Dim sSql as String Dim i as Integer Dim cn as ADODB.Connection, rs as ADODB.Recordset, r AS Long, c ASLong Set cn = New ADODB.Connection cn.Open "Provider=Microsoft.Jet.Oledb.4.0; " & _ "Data Source=C:\DoctorBlades.mdb;" Set rs = New ADODB.Recordset rs.Open "Select * FROM tblDoctorBladesQuery WHERE tblDoctorBladesQuery.MachineLocation = cboMachineLocation.Value",cn,adOpenDynamic,adLockO ptimistic,adCmdText |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel query to access database | Excel Discussion (Misc queries) | |||
Query of an Access database won't let me get more than 95 fields. | Excel Discussion (Misc queries) | |||
Database query to import from Access to Excel | Excel Discussion (Misc queries) | |||
How to use a Access Query that as a parameter into Excel database query | Excel Discussion (Misc queries) | |||
How to do an Access Database Query in Excel | Excel Programming |