Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi! I try to develop a search interface by using Excel, but I have no idea
how can I make the SQL where clause become dynamic. Thanks a lot. The VBA code is below: Sub ado() Dim AlexCon As ADODB.Connection Dim AlexRS As ADODB.Recordset Af = Cells("a10").Value Ase = Cells("b10").Value Set AlexCon = New ADODB.Connection AlexCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=d:\test.mdb" Set AlexRS = New ADODB.Recordset With AlexRS .ActiveConnection = AlexCon .Source = "SELECT * FROM test WHERE B=" &Af &"Or A=" &Ase .Open End With Range("A1").CopyFromRecordset AlexRS AlexRS.Close Set myRecSet = Nothing AlexCon.Close Set AlexCon = Nothing End Sub -- VBA Very Junior |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
connect excel form to access table | Excel Discussion (Misc queries) | |||
How do I connect to access 2007 data from excel? | Excel Discussion (Misc queries) | |||
Help with using ADO to connect Excel to Access | Excel Programming | |||
connect to access database and run a query in excel VBA | Excel Discussion (Misc queries) | |||
ADO Connect Access | Excel Programming |