G
Guest
I have a piece of code listed below that will generate a random number
between 1-100000. I know that it is slim that there will be a match but I
still have to check.
I need to check that the new random number before I add it to the table to
see it is the same as a value already in the table. Basicly I can't have two
of the same random numbers in the table. I need some help with the code that
will check this for me.
Genetic_ID_number is the table where the information needs to go and to
check if there is a duplicate
geneticIDnum is the field which has the random numbers in it
Thanks for the help.
Randomize
RandomNum = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
lblRandom.Caption = RandomNum
strSQL = "INSERT INTO Genetic_ID_number (geneticIDnum) " & "VALUES (" &
RandomNum & ");"
CurrentDb.Execute strSQL
between 1-100000. I know that it is slim that there will be a match but I
still have to check.
I need to check that the new random number before I add it to the table to
see it is the same as a value already in the table. Basicly I can't have two
of the same random numbers in the table. I need some help with the code that
will check this for me.
Genetic_ID_number is the table where the information needs to go and to
check if there is a duplicate
geneticIDnum is the field which has the random numbers in it
Thanks for the help.
Randomize
RandomNum = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
lblRandom.Caption = RandomNum
strSQL = "INSERT INTO Genetic_ID_number (geneticIDnum) " & "VALUES (" &
RandomNum & ");"
CurrentDb.Execute strSQL