If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Taking Parameters from Excel to MS Query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-27-09, 06:14
MattWaple MattWaple is offline
Registered User
 
Join Date: Feb 2009
Posts: 1
Question Taking Parameters from Excel to MS Query

Hi Guys

I'm new, both here, and really to programming in general.

It's become a remit in my job to write reports for a Management Accounting point of view, and because I was stupid enough to open my mouth and say that I had good computer knowledge when we were setting this up I have been given the honour. I have somehow managed to fumble through with the help of various books and Microsoft online help, and am thankfully getting to grips with SQL, however I've now come across a problem which has stumped me for sometime and wondered if anyone can help me?

What I basically have is a Query that interrogates our severs and pulls out all our invoices within a month, and returns the data into an excel spreadsheet. (The query actually just looks at the invoicing table), and I have written a Stored proceedure and included two parameters month and year, which I can then run in MS Query as the following command line.

'EXECUTE [dbo].[proceedure]
@pMonth = ??,
@pYear = ????'

Easy, all I need to do month upon month is go into the query and change the parameters. from month 01 to month 02 and so on.

Now my boss would like to be able to pass this month information from Excel (a logical if not problematic extension)

What I would like to do is link a cell to each of the two parameters. For example

EXECUTE [dbo].[proceedure]
@pMonth = Cell A1
@pYear = Cell A2

but I can't find out what the relevant code would be to reference the relevant cells anywhere.

Any help would really be appreciated.

Thanks in advance.

Matt
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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