473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Need Help With duplicates warning Message box

Hello,
I am not great with coding but I am trying to run code in the before update event procedure on a form to make sure that there isnt already a record that matches the current entry. My Table Name is NEW TRAUMA INSTS and form name is ORDER TRAUMA INSTS, which has a different table as its control source here is the code that I have managed to come up with and it seems to work other than it returns the warning message when there is any value in the field in table NEW TRAUMA INSTS not just a duplicate value:

Private Sub Combo9_BeforeUpdate(Cancel As Integer)
Dim rslt As Integer

If Nz(DLookup("[Catalog Number]", "[NEW TRAUMA INSTS]", "[Catalog Number]= '" & Me.[Catalog Number] & "'"), 0) <> 0 Then
rslt = MsgBox("THIS ITEM IS PENDING ORDER. Do you wish to continue?", vbYesNo)
If rslt = vbNo Then Me.Undo
Cancel = False
If rslt = vbYes Then DoCmd.Save

End If


End Sub

what I really want this to do is search the table for a matching entry and warn the user that there is already a matching entry, with a message box where yes allows continue and no deletes current record, both my yes and no selections work as I want but like I said the warning message is being shown when there is any record in field catalog number not just a duplicate
any help would be greatly appreciated
Aug 5 '10 #1
0 977

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Carl Owenby | last post by:
Re: Microsoft Knowledge Base Article - 174942 "File Modified Outside Source Editor" Warning Message I believe I have discovered a cause of this warning in a specific situation. I encountered...
1
by: Pablo | last post by:
Hi, there, I have a table which has a field (Email) populated with Email address. I am trying to send email using MS Outlook to those addresses. Everything works fine except that a warning message...
3
by: nick | last post by:
i have 5 files,when i use make command to compile them a error occurs "make: Warning: Infinite loop: Target `c.o' depends on itself" when i type make an warning message occurs cc -c b.c cc ...
2
by: Terry | last post by:
Hi, I copied the following code segment from the VS2005 Help on the MouseDown event. Private Sub panel1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles...
1
by: teo | last post by:
I have a Web Form with a Button on it, nothing more. I load the page from VisualStudio2005 Asp Net 2.0 enviroment (with internal server) and immediately go to Save As... the page all is ok. ...
1
by: Ian | last post by:
I've just discovered the msclr::lock class in the C++ Support Library online documentation. This seems like a much cleaner way to implement thread protection than using...
7
by: xian2 | last post by:
Hi All - again, I was wondering if it is somehow possible to have a warning message appear if anything above the number 6 is entered. i have worked out conditional formatting so the box turns a...
2
by: mattmao | last post by:
My code works fine with this command: gcc mycode.c It is compiled and runs just as I wanted. But since my assignment has a specific restriction, my code must go through this: gcc...
2
by: EricDeWerth | last post by:
When I try to call db2move $todbname load from a shell script it will give me this error in the log. When I call it from the command line using the exact same dataset it works perfectly. Does...
1
by: ga3la | last post by:
I have project to do, but really i'm very confiose for much things i must to do. for that i come here to ask for help if anyone have little time and be patient well let me talk about the i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.