dbTalk Databases Forums  

Even/Odd Loop

comp.databases.ms-access comp.databases.ms-access


Discuss Even/Odd Loop in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
Icarus
 
Posts: n/a

Default Re: Even/Odd Loop - 07-28-2011 , 02:22 PM






Quote:
I think you could have presented a row column example or
two to help illustrate your issue. *I'll even show you what I mean
FieldName * Value *Baseline...
01/2011 * * * * *10 * * * 11 *Consecutive
10/2010 * * * * * *5 * * * 11 *Consecutive
07/2010 * * * * *30 * * * 11 *Not
This is pretty close.

I have the function already, but it is just a manually created SQL
string. Since the user might want to see as few as 2 consecutive
quarters, or as many as 8 consecutive quarters, I have manually
created the SQL strings for each possibility.

I was hoping with a for/next loop, the function could see how many
quarters the user wants to see (passed in as a variable), and then
loop through the possibilities, building the SQL string on the fly ((1
and 2) or (2 and 3)). This way I would have to maintain a lot less
code in the event of requirements changes.

Reply With Quote
  #12  
Old   
Patrick Finucane
 
Posts: n/a

Default Re: Even/Odd Loop - 07-29-2011 , 06:55 AM






On Jul 28, 2:22*pm, Icarus <tjmos... (AT) gmail (DOT) com> wrote:
Quote:
I think you could have presented a row column example or
two to help illustrate your issue. *I'll even show you what I mean
FieldName * Value *Baseline...
01/2011 * * * * *10 * * * 11 *Consecutive
10/2010 * * * * * *5 * * * 11 *Consecutive
07/2010 * * * * *30 * * * 11 *Not

This is pretty close.

I have the function already, but it is just a manually created SQL
string. *Since the user might want to see as few as 2 consecutive
quarters, or as many as 8 consecutive quarters, I have manually
created the SQL strings for each possibility.

I was hoping with a for/next loop, the function could see how many
quarters the user wants to see (passed in as a variable), and then
loop through the possibilities, building the SQL string on the fly ((1
and 2) or (2 and 3)). *This way I would have to maintain a lot less
code in the event of requirements changes.
Sounds like a hellatiously long where clause.

I wonder if a (keyword) UNIQUE SQL statement would be of any merit.
It seems that'd be a simple For I.For J loop, especially if you can
increment the dates so you can get the field names of the quarters.

Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.