concrete Posted March 13, 2003 Posted March 13, 2003 can i define a field so it generates an random code of 8 caracters?
RussBaker Posted March 13, 2003 Posted March 13, 2003 This will work for using all the uppercase alphabet letters. If you want to extend it to lowercase and/or numbers etc, then add these characters to the text string and change the number "26" (which is the length of the text string). Middle("ABCDEFGHIJKLMNOPQRSTUVWXYZ",Int(Random*26 + 0.5),1) & Middle("ABCDEFGHIJKLMNOPQRSTUVWXYZ",Int(Random*26 + 0.5),1) & Middle("ABCDEFGHIJKLMNOPQRSTUVWXYZ",Int(Random*26 + 0.5),1) & Middle("ABCDEFGHIJKLMNOPQRSTUVWXYZ",Int(Random*26 + 0.5),1) & Middle("ABCDEFGHIJKLMNOPQRSTUVWXYZ",Int(Random*26 + 0.5),1) & Middle("ABCDEFGHIJKLMNOPQRSTUVWXYZ",Int(Random*26 + 0.5),1) & Middle("ABCDEFGHIJKLMNOPQRSTUVWXYZ",Int(Random*26 + 0.5),1) & Middle("ABCDEFGHIJKLMNOPQRSTUVWXYZ",Int(Random*26 + 0.5),1) If the calculation is unstored, it will update everytime you access the record. So, depending on your intended use, you might want to leave it as a stored calculation. Also, if this is for password generation, then its easy to modify this calc if you want to set rules like the Password must start with a capital letter, the 3rd character must be a number etc, etc. You could also consider removing "I" and "O" from the string (now 24 long) to remove possible confusion between "I" and one, or "O" and sero.
Recommended Posts
This topic is 7997 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now