weird effect

TjS

Registered User.
Local time
Today, 23:27
Joined
Jul 18, 2007
Messages
126
Hellow world,

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!
 
You need to review the key word Randomize() in VBA help to affect the seed.
 
Thanks...that worked indeed! at least on my workspace..

I Have appearantly another problem though.....because access is not locally on the workspace, but distribuated by Novell when clicking on it, on most workspaces i get the error saying "project or library not found' (compile error); is there a way to cope with this?
 
Thanks in advance, it could be helpfull..registering could be a problem though, while the company which are going to use my access application has a very (x 10) secured network policy, no member of the network can install anything at their workspace...
 
Properly installed, I would think you would not have any reference issues.
 
I know; unfortunately, the installation of access is not done on workspaces. Access is on the network, and people start-up ms-access by a novell application launcher. And (as i have seen today) on other workspaces libraries are missing (also relevant ones which uses functions like mentioned - String, Trim etc..-). I have also contacted the IT department to look at this problem, but i thought of another solution:

When i deliver, next to the access db, the needed library dll files on the workspaces (let's say i can install them in c:\temp) then i can point within access the libraries to the c:\temp and they will always be available). I am looking for a code that i can run before the forms in the tool come up (in the background) which:
1) place the dll files on the c:\temp
2) register them (could security on system32 folder be a problem then though?)
3) compile the code
4) start the mainform...


hmm...a lot of workaround for something that should do it directly...
 
If you do not have Access or the Access Runtime installed on your machine or workstation, it sounds like a violation of the Access EULA. You may want to have this reviewed.
 

Users who are viewing this thread

Back
Top Bottom