PC Review


Reply
Thread Tools Rate Thread

How can I execute For...Next loop in calculations ?

 
 
=?Utf-8?B?TmF0a29s?=
Guest
Posts: n/a
 
      24th Mar 2006
I have problem with execution calculations in Access: I need to perform Calc.
1/(0.5/On+0.5/On-1) where On ....On+1 are data in column which could
contain empty cells. My first gess was to create a "For...Next loop", but
this loop has to execute untill On has values.
Can you help?
Thank you,
Nataliya
 
Reply With Quote
 
 
 
 
strive4peace
Guest
Posts: n/a
 
      25th Mar 2006
Hi Nataliya,

the logic in your equation doesn't look right; after
parentheses, multipliplication and division are performerd
before addition and subtraction...

0.5/On+0.5/On-1
will evaulate to (1/On) - 1
....IF On is not null -- if null, you will throw an error

if On-1 is a field name, it is a bad choice since the minus
sign will be interprested as subtraction -- you would need
to enclose it in brackets

if On-1 is a variable name, you should rename the variable
to not include an arithmetic operator

you should always test the denominator anyway since it is
illegal to divide by 0

If you are looking until On has values, you can test for
IsNull in a loop

"On" is a reserved word and should not be used for a fieldname


Warm Regards,
Crystal
MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
*
Have an awesome day


Natkol wrote:
> I have problem with execution calculations in Access: I need to perform Calc.
> 1/(0.5/On+0.5/On-1) where On ....On+1 are data in column which could
> contain empty cells. My first gess was to create a "For...Next loop", but
> this loop has to execute untill On has values.
> Can you help?
> Thank you,
> Nataliya

 
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
Execute code in a loop - Question Les Microsoft Excel Programming 2 29th May 2008 03:57 PM
Trying to execute function after negative if conditional nested in For each loop Red Microsoft Excel Programming 0 21st Aug 2006 09:14 PM
ADO command.execute with a loop - only runs once George King Microsoft Excel Programming 0 9th Feb 2006 06:24 PM
How to execute query in a for loop =?Utf-8?B?SnVkeSBXYXJk?= Microsoft Access Queries 6 7th Oct 2005 06:23 AM
loop calculations in excel? =?Utf-8?B?c2hhbm5vbg==?= Microsoft Excel Programming 2 1st Feb 2005 02:57 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:11 PM.