mardi 15 décembre 2015

How to do microsoft access update query or vb function which use random unique number with in specific numbers range

How can i write ms access update query that updates table records which uses random unique number but with in specific range.

Here what i need help with

Problem

Image which describe problem

Now I have attached problem what i need to do is update tim2 column and time1 column with in specific range based on id1 column.

like where id1 is 101,102 update tim2 between (8.10 to 8.30) and time1 between (9.10 to 9.30) to Random Unique number.

I have tried vb function which generate number between specified range but it update with same number again and again

Public Function RanNumBtw(ByVal LwLimit As Long, ByVal UpLimit As Long) As Long

Randomize

RanNumBtw = Rnd * (UpLimit - LwLimit) + LwLimit

End Function

what this function does is it gives same number again for all cells

query or vb code will help

thanks




Aucun commentaire:

Enregistrer un commentaire