I'm going to try the same thing in one of my forms and see if I can duplicate the error.
unique entry
Collapse
X
-
-
Well I didn't get any errors when I tried, but at the same time, it didn't work at all!
Here's how I did get it to work. You can put some code in the AfterUpdate Event of the textbox.
Private Sub TicketNumtxt_Af terUpdate()
if DCount("CURYear ","Master","CUR Year = """ & [Yeartxt] _
& """ AND TicketNum = """ & [TicketNumtxt] & """") > 0 then
'there is already at least 1 same entry
msgbox "That Ticket Number is already used."
TicketNumtxt = ""
TicketNumtxt.Se tFocus
Else
'it's ok
End If
The only problem I had with this is, it doesn't set the cursor back in the field after it clears it for some reason.Comment
-
Comment