Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Generating a six digit PIN number

Featured Replies

Hi,

I'm using the following calcuation to automatically generate a six digit PIN number:

Round(Random* 1000000, 0)

This calcuation works fine. However, I have noticed that sometimes this calcuation will generate a PIN with ONLY 5 digits (rather than 6.)

Q: Is there a better method to calculate a six digit PIN?

Thanks.

I guess you are not considering zero a valid digit? There is nothing to prevent your calculation from returning a 4 or even 3 digit number since the Random function returns a random number between zero and one. How about adding a six digit number to the result and truncating to six digits?

Left(Round(Random * 1000000, 0) + 123456, 6)

-bd

The problem with "random" numbers is that they are random. 0 is just as likely as 123456.

If you do NOT need to perform heavy mathematical functions on the PIN, then you can make it a Text field as follows:

code:


Right ( "000000" & NumToText ( Round(Random* 1000000, 0) ), 6)


This will generate a 6 digit PIN where leading 0s are OK. It will generate in 000000 to 999999 for the final result.

Rememeber that just because you are using integers does NOT mean that the field must be a number.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.