View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_4_] Dick Kusleika[_4_] is offline
external usenet poster
 
Posts: 595
Default Access table to Excel

Tushar

Here's the step by step. I may be covering stuff you already know.

Data Get External Data New Database Query (maybe slightly different in
different versions)
Choose Data Source: Access Database*
File Open: Choose FY2004OLM.mdb
Choose Columns: All the columns from Download Table
Filter Data: FYQ (first column in table) is greater than or equal to 20021
(this is just a place holder, we'll make it a parameter based on a cell
later)
Sort by: Nothing
Finish: Click View data or edit query in MS Query, then click Finish

MS Query will open and we'll change the criteria to a prompt parameter. You
should have FYQ on the first line of the criteria pane and =20021 right
below it. Change the Value line from =20021 to

=[Enter FYQ]


File Return Data to Microsoft Excel
Enter 20021 when prompted and click OK
Select a range where the data will start. I selected C96.

On the External Data Toolbar, there's a button called Parameters. Click it.
In the Parameters dialog, you should have a parameter named Enter FYQ (and
it should be the only one). With that parameter selected, change the option
button to "Get the value from the following cell" and click in the RefEdit
control directly below it and select A98. Mine put =Sheet1!$A$98 in the
RefEdit control. (We just changed a prompt parameter to a cell parameter.)
Click on the "Refresh automatically..." check box and click OK.

Now you have an external data table with one criterion that is a cell
parameter. If you change A96 or A97 (thereby changing A98), the query table
will refresh to show the new data. Change A96 to 1/3/03, A98 should change
to 20031 and your query table should change to show 1 row (based on the
sample you provided.)

Hopefully that gets you going in the right direction. Post back if you hit
a snag.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com


"Tushar Garg" wrote in message
...

Access Table C=Column
FYQ C1 C2 C3 C4 C5
20021 1 3 4 5 7
20022 3 3 7 7 8
20023 5 7 9 0 0
20024
20031
.
.
.

Excel Table
A96 = 12/24/2002
A97 = 1
A98 = YEAR(A96) + A97

The logic needs to find this FYQ in Access and return all rows from this
FYQ and everything below it. In other words, 20021, 20022, ...all need
to be returned till the very last row. Hopefully this helps man. I am
stumped on this so I could use some big time help. THANKS AGAIN FOR
THIS

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!