Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Your information in this site is absolutely WONDERFUL. It is the most useful site on the web to me right now. Thank You Thank You..."

Geography

Where in the world do Tek-Tips members come from?

Ms Query Parameters in Excel 2007

Salut39 (TechnicalUser)
4 May 12 10:13
Hi Guys,

I have Query in Ms Access 2003 which has parameters set up for Exchange Rates to convert Currency amounts to GBP. I anayse it in Excel 2007 via Ms Query and have a bit of a problem.

Query run fine in Access, when I link to Excel it comes with Error: "Too few parameter. Expected 2" When I remove parameters I can't put them back with Ms Query it says I have Syntax Error.

IIf([Currency 2]="EUR",[EUR Rate],IIf([Currency 2]="USD",[USD Rate],1))

Any idea how to make it work?

Cheers
Yuri
SkipVought (Programmer)
4 May 12 10:43


hi,

Please post the entire SQL that you are using in MS Query.

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Salut39 (TechnicalUser)
4 May 12 11:00
SELECT `Billing Cube Query 1`.ICPN, `Billing Cube Query 1`.`Customer No`, `Billing Cube Query 1`.`Customer Name`, `Billing Cube Query 1`.Country, `Billing Cube Query 1`.Region, `Billing Cube Query 1`.`Bill date`, `Billing Cube Query 1`.`Display Artist Name`, `Billing Cube Query 1`.Title, `Billing Cube Query 1`.`MEA Company Name`, `Billing Cube Query 1`.`International Release Date`, `Billing Cube Query 1`.`Item Type`, `Billing Cube Query 1`.`Currency 2`, `Billing Cube Query 1`.`Exchange Rates`, `Billing Cube Query 1`.Quantity, `Billing Cube Query 1`.`Gross Sales`, `Billing Cube Query 1`.`Net Sales`, `Billing Cube Query 1`.`Royalty / MEA held in TP`, `Billing Cube Query 1`.`MTP Exclude Royalty`, `Billing Cube Query 1`.`PPS Fee`, `Billing Cube Query 1`.`Acetate Cost`, `Billing Cube Query 1`.`Gross Sales £`, `Billing Cube Query 1`.`Net Sales £`
FROM `Billing Cube Query 1` `Billing Cube Query 1`
ORDER BY `Billing Cube Query 1`.`Display Artist Name`
SkipVought (Programmer)
4 May 12 11:33


???

You mention "When I remove parameters I can't put them back with Ms Query "  WHAT PARAMETERS?

Where is your IIF()???

I would say filter the query for each rate plug it in.  HOWEVER, in the MS Query QBE grid interface, you are very limited in what you can do with parameters.  You are limited to a simple Where x=?

I'd use VBA, which I often do.
 

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Salut39 (TechnicalUser)
4 May 12 11:45
It's in my Ms Access Query:

SELECT [02 SAP Billing Report].ICPN, [02 Customer list].[Customer No], [02 Customer list].[Customer Name], [02 Customer list].Country, [02 Customer list].Region, [02 SAP Billing Report].[Bill date], [02 Merch Output].[Display Artist Name], [02 Merch Output].Title, [02 Merch Output].[MEA Company Name], [02 Merch Output].[International Release Date], [02 MTP details].[Item Type], [02 SAP Billing Report].[Currency 2], IIf([Currency 2]="EUR",[EUR Rate],IIf([Currency 2]="USD",[USD Rate],1)) AS [Exchange Rates], [02 SAP Billing Report].Quantity, [02 SAP Billing Report].[Gross Sales], Round([Gross Sales]/[Exchange Rates],2) AS [Gross Sales £], [02 SAP Billing Report].[Net Sales], Round([Net Sales]/[Exchange Rates],2) AS [Net Sales £], [02 MTP details].[Royalty / MEA held in TP], [02 MTP details].[MTP Exclude Royalty], [02 MTP details].[Acetate Cost], [02 MTP details].[PPS Fee]
FROM (([02 SAP Billing Report] INNER JOIN [02 MTP details] ON [02 SAP Billing Report].ICPN = [02 MTP details].ICPN) INNER JOIN [02 Merch Output] ON [02 MTP details].ICPN = [02 Merch Output].ICPN) INNER JOIN [02 Customer list] ON [02 SAP Billing Report].Payer = [02 Customer list].[Customer No];
 
SkipVought (Programmer)
4 May 12 11:59


So are you saying that your Access Query is named `Billing Cube Query 1`?

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Salut39 (TechnicalUser)
4 May 12 12:01
Yes
SkipVought (Programmer)
4 May 12 12:07

Well then you cannot run the FIRST query that you posted, from Excel.  You must run the SECOND query and supply the two parameter values.  As I stated previously, you may have to use VBA to supply the parameters rather than MS Query user interface.

Try MS Query and see if the parameters will work.

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Salut39 (TechnicalUser)
4 May 12 12:15
BTW is there the way to go directly to Query in Access and skip Ms Query. Pardon the pun.
SkipVought (Programmer)
4 May 12 12:17


MS Query IS query!

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Salut39 (TechnicalUser)
4 May 12 12:18
I can always do final calculations in Excel.
Thanks Have a good weekend!
SkipVought (Programmer)
4 May 12 12:19



In VBA forum707: VBA Visual Basic for Applications (Microsoft), via ADO you can do this.

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close