That's a strange one!
That's an odd one. Only way I know of to do this would be with code. Say
your column in the table is called RandNumb, then you would need to open the
table recordset (and open another recordset of the same table for searches)
via code, start at the first record, and use a random function in each loop
to generate a random number. Then before you update the line, do a loop
where you search existing values in the RandNumb column, and keep generating
/ searching until it comes up with a unique random number, then write it.
Keep going until the end of recordset:
Sorry in advance, I just wrote this in this window, so didn't have time to
test. And the code's a bit orthodox, as I'm not using a second do / loop for
the random #. Anyway, it's the basic structure, just may need some
de-bugging. Hope this helps.
Dim db as database, rs as recordset, IntRandNum as integer, TopRandNum as
long
set db=currentDb()
set rs =db.openrecordset("<tblname>",db_open_dynaset)
set rs2=db.openrecordset("<tblname>",db_open_snapshot) 'snapshot. rs2
will be search only
TopRandNum=100000 'set the max random number you would want
rs.movefirst
do until rs.eof
IntRandNum = Int((TopRandNumVal * Rnd) + 1)
contin:
rs2.findfirst "RandNumb = " & IntRandNum
if rs2.nomatch then
rs.edit
rs!RandNumb = IntRandNum
rs.update
else
IntRandNum = Int((TopRandNumVal * Rnd) + 1)
goto contin
end if
rs.movenext
loop
rs2.close
rs.close
set db = nothing
<ar****@yahoo.comwrote in message
news:11**********************@50g2000hsm.googlegro ups.com...
>I need to assign a different random number to each record in one
column in one table in access. How can i do this?