M
MackBlale
I have the following code which at the press of a button generates and
assigns a random 4 digit number as an employee id. When a duplicate is found
I need to generate an error message that says, "Duplicate Found! Please
generate again.
Private Sub GenerateNum_Click()
Dim intMyRanID As Integer
Do
intMyRanID = Int((10000 - 1 + 1) * Rnd() + 1)
Me.ClientID = intMyRanID
Loop While DCount("ClientID", "tblEmployees", "ClientID=" & intMyRanID) > 0
End Sub
Thanks,
Gregory
assigns a random 4 digit number as an employee id. When a duplicate is found
I need to generate an error message that says, "Duplicate Found! Please
generate again.
Private Sub GenerateNum_Click()
Dim intMyRanID As Integer
Do
intMyRanID = Int((10000 - 1 + 1) * Rnd() + 1)
Me.ClientID = intMyRanID
Loop While DCount("ClientID", "tblEmployees", "ClientID=" & intMyRanID) > 0
End Sub
Thanks,
Gregory