473,396 Members | 1,725 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,396 software developers and data experts.

On submit check if duplicate & return w/info

Hello,

I am trying to put some code together for regulating data going into my table. What I am looking for is when the user presses the submit button on the form, a message box pops up if it found that the quote number that was entered into the form has already been used. However, I am also looking for the message box to pull up the name of the quote that was first used.

I am unsure of what information is needed for this but will gladly provide any requested information. A generic example is fine as well.

Thank You,
Sean
Sep 15 '10 #1

✓ answered by liimra

Add this to the "OnClick" event and it should work:

Expand|Select|Wrap|Line Numbers
  1. If DCount("IDFieldName", "QuoteTableOrQueryName", "[IDFieldName] = " & IDFieldNameOnForm) = 1 Then
  2. MsgBox "This ID was used and Quote was" & " " & "'" & DLookup("QuoteFieldName", "QuoteTableOrQueryName", "[IDFieldName] = " & IDFieldNameOnForm) & "'"
  3. ElseIf DCount("IDFieldName", "QuoteTableOrQueryName", "[IDFieldName] = " & IDFieldNameOnForm) = 0 Then
  4. MsgBox "This ID doesn't exit"
It will count if there is another record with the same IDNumber and return the message you choose with the corresponding quote in single quotes "'".

Regards,
Ali

3 1479
liimra
119 100+
Add this to the "OnClick" event and it should work:

Expand|Select|Wrap|Line Numbers
  1. If DCount("IDFieldName", "QuoteTableOrQueryName", "[IDFieldName] = " & IDFieldNameOnForm) = 1 Then
  2. MsgBox "This ID was used and Quote was" & " " & "'" & DLookup("QuoteFieldName", "QuoteTableOrQueryName", "[IDFieldName] = " & IDFieldNameOnForm) & "'"
  3. ElseIf DCount("IDFieldName", "QuoteTableOrQueryName", "[IDFieldName] = " & IDFieldNameOnForm) = 0 Then
  4. MsgBox "This ID doesn't exit"
It will count if there is another record with the same IDNumber and return the message you choose with the corresponding quote in single quotes "'".

Regards,
Ali
Sep 15 '10 #2
Thank you very much, That worked. I completely forgot about Dlookup.
Sep 16 '10 #3
liimra
119 100+
Glad it worked. Would you please mark this post as answered so it becomes more helpful for others.

Regards,
Ali
Sep 16 '10 #4

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

Similar topics

7
by: NotGiven | last post by:
I changed my POST to GET and find appended to the url, the above string. Why and what can I do to NOT have them appended? Thanks.
3
by: Testor | last post by:
I am writing a simple perl script to learn in the process. The script is supposed to grab a receipt number from the query-string and write it into a file. To do that, here's what I did: ...
2
by: Maurice Mertens | last post by:
Hi, I'm building an application in VB.NET that can only be started if the available desktop space is sufficient. This means that when the user starts the application it has to check 2 things: ...
1
by: Ike | last post by:
I'm hoping someone can tell me how to do something which, though trivial to some, I'm really struggling with here. If I have an href, which, through the magic of CSS, we make appear as a button (a...
43
by: Tim Chase | last post by:
Just as a pedantic exercise to try and understand Python a bit better, I decided to try to make a generator or class that would allow me to unpack an arbitrary number of calculatible values. In...
5
by: Alex Maghen | last post by:
In ASPX 2.0 with MasterPages and all that, my entire page only has one actual <FORM>. But there are several different sections of the page that provide what are functionally separate forms with...
2
by: kenno69 | last post by:
Well its a registry form and i want them post there info then when they press submit it will show them there name, email and all that stuff, then i wanted to know if it is possible to submit the same...
3
by: wongray | last post by:
Hello, I need help. I have a form and I would like to do a check when I enter a data into the field and once I press enter into the field it will check whether is duplicate or not. currently...
10
by: kelvin | last post by:
Hi, A difficult question. I have a form that I used to submit to https://www. paypal.com/cgi-bin/ webscr <form action="https://www. paypal.com/cgi-bin/webscr" method="post"> Now I need to...
2
by: irsmalik | last post by:
Hi Friends, I am developing Engineering Document System which keep the record for all kind of Engineering Drawings and other related documents in MS Access + VBA. Table Details are Drawing No, ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...

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.