storing a value

K

kate

I have created the following a acrostic (below) and would
like to find a way to either store the random number
value in the table so that it can be retrieved for the
Acrostic or prevent a new value from being generated once
one has been created. If a patientcode has been created
and the LocationCode and/or the abstractorcode fields are
updated, the random number assigned also changes when the
command button is clicked to cpature the changes made in
the first two fields. I am trying to find a way (if
possible, VBA code) to stop the random number from
changing once one has been created for a form. Can
anyone Help?

Private Sub CmdPasteRandomID_Click()
Dim RandomNumber As Long

Randomize ' Initialize random-number generator.
' Generate random value between 999, 999 And 100, 0#
Random = Int((999999 - 100000 + 1) * Rnd + 100000)
PatientCode = Format([AbstractorCode], "00") & Format
([LocationCode], "00") & [Random]

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top