Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

change message -you cannot go to specific record

Posted on 2011-03-10
3
Medium Priority
?
313 Views
Last Modified: 2012-05-11
Hello ,
i have a serial number field indexed as unique field-
if someone tries to enter duplicate serial number in a access form- a message displays- you cannot go to specific record-
is there anyway to change words in message to- serial number already exists?
thank you
0
Comment
Question by:davetough
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 35098922
Dave,

Is there any existing code that display the "you cannot go to specific record"? If there is, you may post it here, we just need to tweak it.

If there's none, you may use the code below:

If Dcount("SerialNumber","YourTable","[SerialNumber]='" & Nz(Me.SerialNumber,0) & "'")>1 Then
MsgBox "Serial number already exist."


Sincerely,
Ed
0
 

Author Comment

by:davetough
ID: 35099011
if you open database- open form button and then-
where you add record-
if you try to add a duplicate- it will give you message
thank you
EXample.mdb
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 35099300
you have to test  using  >0 to check if a serial number already exists, and use the beforeupdate event of the field

private sub serialNumber_beforeupdate(cancel as integer)
If Dcount("SerialNumber","YourTable","[SerialNumber]='" & Nz(Me.SerialNumber,0) & "'")> 0 Then
MsgBox "Serial number already exist."
cancel=true
end if

end sub

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question