B
B.L
I am trying to figure out a way to store or prevent
the "random" value from being re-generated each time the
command button to create the PatientCode (see below)is
clicked.
The locationcode and the abstractor code fields are
sometimes updated but when the command button is clicked
to capture these updates in the the patientcode a new 6-
digit random number is generated. Is there any code or
means of retaining the first random value generated in
the table so that it can be retrieved for the acrostic or
is there code that I can add to the patientcode module to
prevent a new number from being generated if one had been
created previously
The code used to generate the acrostic -(patientcode) is
below:
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)
' Set random in basicshortcrf table to RandomNumber
' Set Random = RandomNumber
PatientCode = Format([AbstractorCode], "00") & Format
([LocationCode], "00") & [Random]
End Sub
Thanks in advance
the "random" value from being re-generated each time the
command button to create the PatientCode (see below)is
clicked.
The locationcode and the abstractor code fields are
sometimes updated but when the command button is clicked
to capture these updates in the the patientcode a new 6-
digit random number is generated. Is there any code or
means of retaining the first random value generated in
the table so that it can be retrieved for the acrostic or
is there code that I can add to the patientcode module to
prevent a new number from being generated if one had been
created previously
The code used to generate the acrostic -(patientcode) is
below:
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)
' Set random in basicshortcrf table to RandomNumber
' Set Random = RandomNumber
PatientCode = Format([AbstractorCode], "00") & Format
([LocationCode], "00") & [Random]
End Sub
Thanks in advance