?
Solved

change message -you cannot go to specific record

Posted on 2011-03-10
3
Medium Priority
?
311 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
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…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Suggested Courses

764 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