prevent Dublicate ID by Date()

no need to send, I can see the issue. we are now on post #21 - please review post #4

Also, 3.5mb is tiny - limit is 2gb, sharing or not
 
thanks CJ_London your suggestion is useful

finally i solved this problem the code like this :

Private Sub employee_ID_AfterUpdate()
Dim NewId As String
Dim strLink As String

NewId = Me.employee_ID.Value
strLink = "[employee ID]=" & NewId

If Me.employee_ID = DLookup("[employee ID]", "hatn_w_roshtn", strLink & " And Format(barwar, ""mmddyyyy"") = " & Format(Date, "mmddyyyy")) Then
MsgBox "ffffff"
Me.Undo
End If
End Sub
 
again i have another problem :mad:

Run-time error '3464': Data type mismatch in criteria expression

that program made me mad
when i test id = 1111111 barwar=8-6-2016 give me this error
but when i test id= 2222222 barwar=8-6-2016 its work without error

If Me.employee_ID = DLookup("[employee ID]", "hatn_w_roshtn", strLink & " And Format(barwar, ""ddmmyyyy"") = " & Format(Date, "ddmmyyyy"))
 
The error message says you are trying to compare different data types - e.g. text and dates.

try changing

....And Format(barwar, ""ddmmyyyy"") ="....

to


....And Format(barwar, 'ddmmyyyy') ="...

or just try

strLink & " And barwar = " & Date

However I go on holiday today so this will be my final response for a couple of weeks.

If the above doesn't work, suggest start a new thread, but provide example details of what you really have in your table - type, names and sample data as it really is
 

Users who are viewing this thread

Back
Top Bottom