RANDBETWEEN like function in Access calculated query field

world33

Registered User.
Local time
Today, 20:28
Joined
Oct 24, 2006
Messages
21
Hello,

Is there any module, function, expression or other way to mimic an Excel RANDBETWEEN function in a MS Access calculated query field?
I read that it is possible to use Excel functions in Access but my level is too basic to be able to apply that option.
I am looking for a query expression that allows me to randomly choose a text value. For example:
RANDBETWEEN(Founded in, Established in) or RANDBETWEEN(located in, situated in, etc.).
Any idea or workaround to achieve that?

Thanks for any help.

world33
 
Access VBA has RND function which returns a random number. It can be used in query or VBA. Use it in conjunction with RANDOMIZE function in VBA.
 
Access VBA has RND function which returns a random number. Use it in conjunction with RANDOMIZE function.

Emulating the Excel RANDBETWEEN function will involve writing custom function in VBA.
Thanks. How Do I combine them to generate random text?
 
Apparently I edited my previous post after you read it.

What kind of text do you want - a single character?
 
somewhere i get this:

Code:
Public Function RandBetween(Optional Lowest As Long = 1, Optional Highest As Long = 9999)
' Generates a random whole number within a given range
   Randomize (Timer)
   RandomNumber = Int(Rnd * (Highest + 1 - Lowest)) + Lowest
End Function
you can only pass numeric value.
use PK field and Dlookup() its value to generate
a Random String.
 

Users who are viewing this thread

Back
Top Bottom