PC Review


Reply
Thread Tools Rate Thread

Compound loop statement

 
 
=?Utf-8?B?R3JhaGFt?=
Guest
Posts: n/a
 
      13th Nov 2006
I cannot figure why the following code drops out early

Do While Cells(1, iArrayCol).Value <> iCurrYr _
And Cells(2, iArrayCol).Value <> iCurrMth

iArrayCol = iArrayCol + 1
Loop

iCurrYr = 2006
iCurrMth = 10

But, the loop terminates when it gets to the values 2005 & 10.

The correct values are in the data.

I'm at a loss.
--
Graham
 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      13th Nov 2006
Graham,
Change And to Or
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Graham" <(E-Mail Removed)>
wrote in message
I cannot figure why the following code drops out early

Do While Cells(1, iArrayCol).Value <> iCurrYr _
And Cells(2, iArrayCol).Value <> iCurrMth

iArrayCol = iArrayCol + 1
Loop

iCurrYr = 2006
iCurrMth = 10

But, the loop terminates when it gets to the values 2005 & 10.
The correct values are in the data.
I'm at a loss.
--
Graham
 
Reply With Quote
 
=?Utf-8?B?R3JhaGFt?=
Guest
Posts: n/a
 
      13th Nov 2006
Thanks Jim

That fixed it.

I have a history of problems with logical and & logical or. Despite being
conscious of it and giving these things extra thought, I still get it wrong.
--
Graham


"Jim Cone" wrote:

> Graham,
> Change And to Or
> --
> Jim Cone
> San Francisco, USA
> http://www.realezsites.com/bus/primitivesoftware
>
>
> "Graham" <(E-Mail Removed)>
> wrote in message
> I cannot figure why the following code drops out early
>
> Do While Cells(1, iArrayCol).Value <> iCurrYr _
> And Cells(2, iArrayCol).Value <> iCurrMth
>
> iArrayCol = iArrayCol + 1
> Loop
>
> iCurrYr = 2006
> iCurrMth = 10
>
> But, the loop terminates when it gets to the values 2005 & 10.
> The correct values are in the data.
> I'm at a loss.
> --
> Graham
>

 
Reply With Quote
 
Jim Cone
Guest
Posts: n/a
 
      13th Nov 2006

You are not alone; had a few mix-ups myself.
Jim Cone


"Graham" <(E-Mail Removed)>
wrote in message
Thanks Jim
That fixed it.
I have a history of problems with logical and & logical or. Despite being
conscious of it and giving these things extra thought, I still get it wrong.
--
Graham


"Jim Cone" wrote:
> Graham,
> Change And to Or
> --
> Jim Cone
> San Francisco, USA
> http://www.realezsites.com/bus/primitivesoftware
>
>
> "Graham" <(E-Mail Removed)>
> wrote in message
> I cannot figure why the following code drops out early
>
> Do While Cells(1, iArrayCol).Value <> iCurrYr _
> And Cells(2, iArrayCol).Value <> iCurrMth
>
> iArrayCol = iArrayCol + 1
> Loop
>
> iCurrYr = 2006
> iCurrMth = 10
>
> But, the loop terminates when it gets to the values 2005 & 10.
> The correct values are in the data.
> I'm at a loss.
> --
> Graham
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compound IIF Statement DAC Microsoft Access Queries 2 26th Jun 2009 07:28 PM
Compound IF statement =?Utf-8?B?RGk=?= Microsoft Excel Programming 8 18th Sep 2007 05:12 PM
Compound IF Statement? =?Utf-8?B?QnJvb2s=?= Microsoft Access Queries 7 10th Mar 2006 06:09 PM
Compound Statement =?Utf-8?B?YmxhZGVsb2Nr?= Microsoft Access Reports 1 26th Sep 2005 05:08 PM
Compound loop conditions Bill Microsoft Access Form Coding 2 14th Apr 2005 05:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:28 PM.