LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.links,microsoft.public.excel.querydao,microsoft.public.excel.worksheet.functions,microsoft.public.sqlserver.connect
DM Unseen
 
Posts: n/a
Default Variable SQL Statements pulling from a cell in Excel

Use http://vangelder.orcon.net.nz/ QueryEditor to get around this
limitation.
BTW a table cannot be a variabl/parametere in an SQL query so you'll
need to update the SQL statement manually for each TABLE.
Using VBA would be the best. Here is some speudo code you could use
after you created the Query manually first

DIm qtb as QueryTable
DIm strTable as String
Const Query = "Select * FROM %TABLE% where year=?"

Set qtb = Activesheet.QueryTables(1)
qtb.CommandText = Query
strTable = Inputbox("Enter a table Name")
qtb.CommandText = replace(Query,"%TABLE%",strTable)
qtb.refresh

DM Unseen

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple or Variable cell references in Solver (Excel 97) Coreyhotlin Excel Worksheet Functions 1 February 14th 06 01:36 PM
Automatically Changing Cell Reference's when Pasting in Excel No I'm Spartacus Excel Discussion (Misc queries) 0 February 13th 06 01:01 PM
I want to use a formula in excel to highlight a cell 30 days prio MWad22368 Excel Worksheet Functions 1 February 13th 06 02:51 AM
copying cell names Al Excel Discussion (Misc queries) 12 August 11th 05 03:01 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM


All times are GMT +1. The time now is 02:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"