Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Need help with retrieving data using SQL via an ODBC source. Need to use a cell value as a retrieval key. Can someone point me to a good reference for this?
|
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Clint,
Here is some code that you can modify. I have used a variable called User as the entry from an Input box, but you can change it to reference a cell value too. User = InputBox("Who are you?", "Enter your name", "Bede") With ActiveSheet.QueryTables.Add(Connection:=Array(Arra y( _ "ODBC;DSN=MS Access Database;DBQ=P:\BugDataBase\DI CM.mdb;DefaultDir=P:\BugDataBase;DriverId=281;FIL= MS Access;MaxBufferSize=2048;Pag" _ ), Array("eTimeout=5;")), Destination:=Range("A1")) .CommandText = Array( _ "SELECT `Bugs`.bug_id, `Bugs`.priority, `Bugs`.description, `Bugs`.date, `Bugs`.bug_assignee, `Bugs`.reported_by, `Bugs`.resolution" _ , _ ", `Bugs`.fixed" & Chr(13) & "" & Chr(10) & "FROM `P:\BugDataBase\DI CM`.`Bugs` `Bugs`" & Chr(13) & "" & Chr(10) & "WHERE (`Bugs`.reported_by Like '%" & User & "%')" _ ) .Name = "Query from MS Access Database" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = True .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .PreserveColumnInfo = True .Refresh BackgroundQuery:=False End With HTH, Greg "Clint" wrote in message ... Need help with retrieving data using SQL via an ODBC source. Need to use a cell value as a retrieval key. Can someone point me to a good reference for this? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Changing data source on ODBC query | Excel Discussion (Misc queries) | |||
change odbc data source | Excel Worksheet Functions | |||
Retrieving data with SQL and ODBC selected by key values in cells | Excel Programming | |||
Retrieving data from Access via SQL/ODBC | Excel Programming | |||
Retrieving Source Data From Pivot Table | Excel Programming |