Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Ranged AND

Author
Message
Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 2nd Nov 2011 00:05
Just cant think at the moment so need to post this in here because i will come up with the solution only when i hit post. Not a second before, always happens.

If i randomize a number between 1 + 100
a = RND(99) + 1

How to i check that number is within a range. The AND statement doesnt work as it will only return a boolean value which to be honest i thought logically works ok for me, but it doesnt like it.

So:
If a > 0 AND < 21 ` If its more than 0 and less than 21 so therefore if the number is between 1 and 20? Am i right?

Logically wouldnt it go through each of those declarations and check it and return it with a 1 and 1 if the number was 15 say for example?

If a > 0 = is 'a' more than 0, yes, so 1
If a < 21 = is 'a' less than 21, yes, so 1
The AND statement needs both to be 1 so it is and that should work. It doesnt because i have missed something profoundly simple that i just cant think about right now. Can anyone help?
Somarl
13
Years of Service
User Offline
Joined: 11th Feb 2011
Location: UK
Posted: 2nd Nov 2011 00:08
Right on schedule, the second i pressed post i knew what i had done wrong.

If a > 0 AND a < 21

Not as i put above a > 0 AND < 21
Its got no way to know what im talking about, is what under 21.

Knew postnig it on here would make me come up with the answer, happens every time.
If any mods want to delete this shockingly stupid thread then please spare me the shame and do so.
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 2nd Nov 2011 01:30
Quote: "Knew postnig it on here would make me come up with the answer, happens every time."


You are absolutely right!

Cheers.

I'm not a grumpy grandpa

Login to post a reply

Server time is: 2024-11-24 00:28:18
Your offset time is: 2024-11-24 00:28:18