first of all thanks for reply Ranman256
the whole database contain duplicate record but per day don't allow duplicate record
my database create for upsend employee
this code prevent employee-id used twice per day
for example if employee_ID=123 and today is 13/07/2016
this ID only allowed...
i have a form contain VBA code
but when i input data to it in exit it save only the last input
anyone can tell me how to solve that problem :)
the form include three field like this:
employee-id= number (joined with other field -AutoNumber-)
barwar= short-date
hatn= Time
the VBA Code :-...
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...
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]"...
loo at this picture
by your suggestion i change the name of the table and my [barwar] datatype is date/time
https://drive.google.com/file/d/0BxiJgqgtaqUbTmlXVDRRb1ZwYjg/view?usp=sharing
CJ_London
this is the code but not work
my Database size is 3.5MB i don't now this size is allowable to share if its ok
i sent it to you if you can check it for me by yourself
Private Sub employee_ID_AfterUpdate()
Dim NewId As String
Dim StLink As String
NewId = Me.employee_ID.Value
StLink =...
my friend as i say without using the highlighted in red code is work but when i add date function to it
i get the error message 13
i think that solution you gave to me is not work
by writing code like post#2 the whole code is neglected by system and run like nothing happen :banghead:
my friend let's focus on my problem now and try to solve it
after that if again i have problem
you or anyone that like to help others help me :)
my code work perfect by this way :-
Private Sub employee_ID_AfterUpdate()
Dim NewId As String
Dim StLink As String
NewId = Me.employee_ID.Value...
thanks again my friend for your reply
in previous i used micro SetValues Function in after update
but now i remove it because in micro i can't prevent duplicate id by date
now i am using VBA after update
now the [barwar] field doesn't update automatically
after i solve this problem i can...
:) yes you right
but i change my computer date to 30/05/2016
then i change it to 1/06/2016
and i manually in put id=1111111 and barwar=1/06/2016
and then used form input
still the same problem
now i dont have error but if function not work
for example in table (hatn w roshtn) i have employee ID=3333333 and barwar=30/05/2016
but when i use input form they let me again use 3333333
first of all thanks for answer
then when i type your code the accesss automatically changed to strLink & " And [barwar]=" & Date
when i check it
i have runtime error 13 type mismatch
yes date is today
and [barwar] is field in the same table (hatn w roshtn)
i want do not let input id twice in the same Date
the problem is red color i don't know how to solve this issue
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 =...