Hellow world,
A little question, but driving me crazy....
i have a module: Randomizer
This module has the following code:
Maybe it is obvious, but a little more explaining: a random number is picked together with the numeric systemdate and time.
Every user gets a copy of the access db, to retreive information from a oracle db. Within the oracle db, there is made a table in which general information and the nRandom number is stored.
This is to be able to retreive data in the access db in a quick way without having to loose performance. (the table is related to other tables, so that only that needed information can be displayed); in the query the where clause is equalled to the nRandom number.
Now my problem:
It seems, that the random number is ALWAYS the same, even if access is closed and reopened (and i mean the MS-Access, not only the db, but the full application)....When putting the first part of the code not above the function, but within the function, randomizing numbers works correctly (but then the problem is of course that the numbers are ALWAYS random, and the information can never be selected); putting the dim part above the function should make the number random ONLY for the session of Access at that particular time, and when closing full ms-access, and reopening later on, a new number is created for that session only (and so on...)...
but like i said, the number retreived is ALWAYS the same, even when closing the full MS-access application.
Even when i use a splashscreen and the nID is set to "", the number remains.....
Please help if possible!
A little question, but driving me crazy....
i have a module: Randomizer
This module has the following code:
Code:
dim nID as string
_______________
function nRandom() as String
If nID = "" Then
nID = Round(Rnd(Now()) + Rnd(Right(1, 3)) * 100000) ' Rnd(Now()) + Rnd(Right(1, 3)) * 100000
End If
nRandom = nID
End Function
Maybe it is obvious, but a little more explaining: a random number is picked together with the numeric systemdate and time.
Every user gets a copy of the access db, to retreive information from a oracle db. Within the oracle db, there is made a table in which general information and the nRandom number is stored.
This is to be able to retreive data in the access db in a quick way without having to loose performance. (the table is related to other tables, so that only that needed information can be displayed); in the query the where clause is equalled to the nRandom number.
Now my problem:
It seems, that the random number is ALWAYS the same, even if access is closed and reopened (and i mean the MS-Access, not only the db, but the full application)....When putting the first part of the code not above the function, but within the function, randomizing numbers works correctly (but then the problem is of course that the numbers are ALWAYS random, and the information can never be selected); putting the dim part above the function should make the number random ONLY for the session of Access at that particular time, and when closing full ms-access, and reopening later on, a new number is created for that session only (and so on...)...
but like i said, the number retreived is ALWAYS the same, even when closing the full MS-access application.
Even when i use a splashscreen and the nID is set to "", the number remains.....
Please help if possible!