Help With If Statement (1 Viewer)

spectrolab

Registered User.
Local time
Today, 14:48
Joined
Feb 9, 2005
Messages
116
Hi Everyone,

I was just wondering if there is a way to have an if statement that can determine if the number it is referencing is a multiple of another number?

Like:

If "my integer" = " a multiple of 10" THEN etc...

can I write it as

If "my integer" = 10 or 20 or 30 or 40 etc THEN...

This might get a bit messy if there were 100's of possible values (which there may be in my case).

The code I am using this for adds records to a table between certain user defined numbers, and every 10th record added does some other code.

Another issue I have with this code is really puzzling me, any help would be appreciated.

The code is linked to a command button, after the user puts in the number range required (say 100 to 300 for example) they click the button and the records are added. They can then change the number range and add more records. Is there any way to "remember" how many times this button has been pressed?

Thanks for all your help.
 

wazz

Super Moderator
Local time
Today, 14:48
Joined
Jun 29, 2004
Messages
1,711
without getting into the whys and wherefores of what you're doing, you can use MOD (modulus) as a start:
23 mod(10) = 3
20 mod(10) = 0

means:
23 / 10 leaves a remainder of 3 (23 is not divisible by 10)
20 / 10 leaves a remainder of 0 (20 is divisible by 10)

If 23 mod(10) = 0 Then ...
Else
End If
 

Users who are viewing this thread

Top Bottom