Random ID generator

E

erick-flores

Hello all, I know this question has been asked a lot. But I just cant
find the right answer. I will like to generate a random ID number into
my ID field (which is the primary key in my Access db) everytime I open
a form, how do I do this, so when I load the form the ID number is
already in there, and the user can not change it

Help pleaseee, thanks
 
E

erick-flores

Hello, this is what I am doing, and I cant get it to work
I clicked on On Load Event, then I tried putting different lines of
code. The field on my ID is called "ID" (I created a db in Access and
add a field for each table name: ID). I then drag and drop all the
fields from one of my table to the form, so the ID field is in the
form. My question is, how do I write this code, where do I put the "ID"
name in the code. Is it like: var ID =
new ActiveXObject("Scriptlet.TypeLib").guid.substring( 0, 38);
or
var ID = System.Guid.NewGuid(); ?
is that all the code I need to write? I am so confused, sorry for been
such a novice.
I tried both codes and they did not work, i just wrote those lines like
this:
function XDocument::OnLoad(eventObj)
{
var ID = new ActiveXObject("Scriptlet.TypeLib").guid.substring( 0,
38);// Write your code here
}

Do I need to write something else ???

Pleasee helppp

Thank youu
 
Top