G
Guest
I have a piece of my code below in which a random number is created (RandomNum)
In the code below the random number is being inserted in a new row after all
of the other information. So I have 2 rows being inserted one with all of
the patient information and no random number it the field it is suppose to be
in then second row has no patient information but has the random number.
How can I get the random number to be inserted at the same time as the rest
of the information.
Randomize
RandomNum = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
If DCount("[geneticIDnumber]", "[Patient_Registry]", "[geneticIDnumber]=" &
RandomNum) = 0 Then
If LongTermConsent.Value <> Yes Or No Then
strSQL = "INSERT INTO Patient_Registry (geneticIDnumber) " & "VALUES
(" & RandomNum & ");"
CurrentDb.Execute strSQL
DoCmd.GoToRecord , , acNewRec
Else
MsgBox ("All Fields must be entered")
End If
End If
In the code below the random number is being inserted in a new row after all
of the other information. So I have 2 rows being inserted one with all of
the patient information and no random number it the field it is suppose to be
in then second row has no patient information but has the random number.
How can I get the random number to be inserted at the same time as the rest
of the information.
Randomize
RandomNum = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
If DCount("[geneticIDnumber]", "[Patient_Registry]", "[geneticIDnumber]=" &
RandomNum) = 0 Then
If LongTermConsent.Value <> Yes Or No Then
strSQL = "INSERT INTO Patient_Registry (geneticIDnumber) " & "VALUES
(" & RandomNum & ");"
CurrentDb.Execute strSQL
DoCmd.GoToRecord , , acNewRec
Else
MsgBox ("All Fields must be entered")
End If
End If