473,856 Members | 1,568 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Use Parameter Values in Variable Names

Dear NG -

I was able to figure out how to use the IIF to compute the difference
in deer-vehicle accidents between years (2004 and 2005). My question
is, is it possible to use the results of the parameters in the variable
names or as variable names themselves? For instance, instead of [Y1]
and [Y2], is it possible to somehow use the returned value of YEAR1 and
YEAR2 (in this case, 2004 and 2005) either as new variable names or
parts thereof such as in a concatenation like Y&[YEAR1]?

ANY HELP AT ALL WOULD REALLY BE APPRECIATED.

MIKE

THIS IS MY QUERY BELOW

SELECT DeerVehicleAcci dents.COUNTY, Sum(IIf([YEAR]=[YEAR1],[DVAS],0))
AS Y1, Sum(IIf([YEAR]=[YEAR2],[DVAS],0)) AS Y2, (([Y2]-[Y1])/[y1])*100
AS PercentChange
FROM DeerVehicleAcci dents
GROUP BY DeerVehicleAcci dents.COUNTY;

Sep 5 '06 #1
5 1385
It sounds like you want to use an Alias for some field names - or result
values. You need to specify a little more detail what you need. For
example, in the query you included in your post - is this a working
query? Or is this a query you are trying to get to work?

If this is the query that you are trying to get to work - what is the
error message you get when you try to run it? You should also include
some samples of what your data looks like and what the resultset needs
to look like.

If the query you included is not the query that you are trying to get to
work, then you should include the query that you are trying to get to
work.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Sep 5 '06 #2
Rich,

Sorry about the shortage of detail. The query I included works
perfectly, from the standpoint that it gives me the percent change that
I'm looking for. I was just "fine tuning" with my question. If I
could include the year in the new variable name, it would just be a
little easier to keep track of what is being compared. Just tidying up
a bit, I suppose you could say.

Mike
Rich P wrote:
It sounds like you want to use an Alias for some field names - or result
values. You need to specify a little more detail what you need. For
example, in the query you included in your post - is this a working
query? Or is this a query you are trying to get to work?

If this is the query that you are trying to get to work - what is the
error message you get when you try to run it? You should also include
some samples of what your data looks like and what the resultset needs
to look like.

If the query you included is not the query that you are trying to get to
work, then you should include the query that you are trying to get to
work.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Sep 5 '06 #3
Bri
Takeadoe wrote:
Rich,

Sorry about the shortage of detail. The query I included works
perfectly, from the standpoint that it gives me the percent change that
I'm looking for. I was just "fine tuning" with my question. If I
could include the year in the new variable name, it would just be a
little easier to keep track of what is being compared. Just tidying up
a bit, I suppose you could say.

Mike
No, AFAIK, you cannot use the results of a calculation in the alias
(what you are calling the variable name) for a field. You could
concatinate additional text to the results of the calculation, but the
alias name needs to be static.

--
Bri

Sep 5 '06 #4
Bri - two things THANKS and what is AFAIK?

Mike

Bri wrote:
Takeadoe wrote:
Rich,

Sorry about the shortage of detail. The query I included works
perfectly, from the standpoint that it gives me the percent change that
I'm looking for. I was just "fine tuning" with my question. If I
could include the year in the new variable name, it would just be a
little easier to keep track of what is being compared. Just tidying up
a bit, I suppose you could say.

Mike

No, AFAIK, you cannot use the results of a calculation in the alias
(what you are calling the variable name) for a field. You could
concatinate additional text to the results of the calculation, but the
alias name needs to be static.

--
Bri
Sep 5 '06 #5
Bri
Takeadoe wrote:
Bri - two things THANKS and what is AFAIK?

Mike
As Far As I Know

--
Bri

Sep 6 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2090
by: Michael Krasnyk | last post by:
Hi, How can I print variable values by their names? For example: import sys for str in dir(sys): print str Will be printed only variable names, but I need values from list of variable names.
0
2085
by: barbara | last post by:
I am using this procedure from net for getting the restore script. It lists the latest full backup file name and logs after that point. Is there any way to modify this script to take either date or time as parameter and give the files for restore? I need this if I need to restore the data up to last week/upto some point of time. CREATE procedure usp_what_files_to_restore as --
1
6032
by: Randell D. | last post by:
HELP! I am determined to stick with this... I'm getting there... for those who haven't read my earlier posts, I'm createing what should be a simple function that I can call to check that required fields in a form have values. I'm writing the values to the client using document.write only so that I can confirm that the values are there to be played with - this is not the final result so please (unless it's leading to the script failure)...
5
5045
by: hpi | last post by:
Hello, I have a table : Batch It contains fields batchnummer : Number (Long Integer) datum : Date/Time status : Number (Long Integer) nr_records : Number (Long Integer)
4
16998
by: Todd Perkins | last post by:
Hello all, surprisingly enough, this is my first newsgroup post, I usually rely on google. So I hope I have enough info contained. Thank you in advance for any help! Problem: I am getting this error when I try to pull up my edit page to display the current database information in the form, and then edit it on click:
10
3291
by: Tracy | last post by:
Dear all, I have encountered a problem in passing a VARCHAR parameter (which is a list of accepted values) to the IN predicate of a DB2 user-defined function. For example, I have a table (mytable) storing ppl names & their corresponding groups. I would like to create a UDF (myfunc) that select a list of ppl names from (mytable) who belong to some dynamic choices of groups. I have tried the following codings but it doesn't work if I
16
10984
by: Preben Randhol | last post by:
Hi A short newbie question. I would like to extract some values from a given text file directly into python variables. Can this be done simply by either standard library or other libraries? Some pointers where to get started would be much appreciated. An example text file: ----------- Some text that can span some lines.
9
2702
by: serge | last post by:
/* Subject: How to build a procedure that returns different numbers of columns as a result based on a parameter. You can copy/paste this whole post in SQL Query Analyzer or Management Studio and run it once you've made sure there is no harmful code. Currently we have several stored procedures which final result is a select with several joins that returns many
7
7219
by: =?ISO-8859-2?Q?Gregor_Kova=E8?= | last post by:
Hi! Is it possible to use parameter markers like this: 1.) SELECT * FROM TABLE1 WHERE FIELD1 LIKE '%?%' If I now set parameter 1 to '' (empty string) I don't get any rows back, but if I run: 2.) SELECT * FROM TABLE1 WHERE FIELD1 LIKE '%%' I get back data I expect.
0
9916
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11057
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10696
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10782
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10384
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7932
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7094
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5761
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4174
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.