Using ADODB, how do I create a msgbox when duplicate data is enter

Hello,

I am having a problem creating a msgbox, when data entered through a form 
into a table is duplicated.  I would like for a msgbox to popup, and warn the 
user for dupliucate data, before the actual data is entered into the table.  
I have an index for no duplicate set on a field in a table.  How would I go 
about this?  I have seen code for Jet, and have tried to translate it over to 
ADODB, but with many problems.  Any help with this will be greatly 
appreciated.

Thanks
0
Utf
5/29/2007 5:21:00 PM
access 16762 articles. 3 followers. Follow

3 Replies
683 Views

Similar Articles

[PageSpeed] 24

I don't know the code which is causing the problems with Jet but have you 
tried working with the 'match' something like:

before_update from the form

open the recordset and look for a match if there is a match raise the 
messagebox and exit the sub so the user can make the changes and otherwise 
resume with the record append to the table.


-- 
Maurice Ausum


"Chrism" wrote:

> Hello,
> 
> I am having a problem creating a msgbox, when data entered through a form 
> into a table is duplicated.  I would like for a msgbox to popup, and warn the 
> user for dupliucate data, before the actual data is entered into the table.  
> I have an index for no duplicate set on a field in a table.  How would I go 
> about this?  I have seen code for Jet, and have tried to translate it over to 
> ADODB, but with many problems.  Any help with this will be greatly 
> appreciated.
> 
> Thanks
0
Utf
5/29/2007 6:30:01 PM
How would I go about doing this?  I try to "match" what is already in the 
recordset, and I get Runtime Errors with Access.   I just need to match 1 set 
of data, out of 6 that is getting entered.

"Maurice" wrote:

> I don't know the code which is causing the problems with Jet but have you 
> tried working with the 'match' something like:
> 
> before_update from the form
> 
> open the recordset and look for a match if there is a match raise the 
> messagebox and exit the sub so the user can make the changes and otherwise 
> resume with the record append to the table.
> 
> 
> -- 
> Maurice Ausum
> 
> 
> "Chrism" wrote:
> 
> > Hello,
> > 
> > I am having a problem creating a msgbox, when data entered through a form 
> > into a table is duplicated.  I would like for a msgbox to popup, and warn the 
> > user for dupliucate data, before the actual data is entered into the table.  
> > I have an index for no duplicate set on a field in a table.  How would I go 
> > about this?  I have seen code for Jet, and have tried to translate it over to 
> > ADODB, but with many problems.  Any help with this will be greatly 
> > appreciated.
> > 
> > Thanks
0
Utf
5/29/2007 8:22:00 PM
here is advice from Steve Schapel that helped on a similar requirement:
------------------------------------------------------------------------------------------
Make a macro with the MsgBox action, and enter an appropriate message to 
display.  In the Condition (if you can't see a Condition column in the macro 
design window, select it from the View menu), put the equivalent of this...
  DCount("*","YourTable","[FieldName]='" & [TextBoxName] & "'")>0

Assign this macro on the Before Update event of your form, .
-- 
Steve Schapel, Microsoft Access MVP

-- 
NTC


"Chrism" wrote:

> How would I go about doing this?  I try to "match" what is already in the 
> recordset, and I get Runtime Errors with Access.   I just need to match 1 set 
> of data, out of 6 that is getting entered.
> 
> "Maurice" wrote:
> 
> > I don't know the code which is causing the problems with Jet but have you 
> > tried working with the 'match' something like:
> > 
> > before_update from the form
> > 
> > open the recordset and look for a match if there is a match raise the 
> > messagebox and exit the sub so the user can make the changes and otherwise 
> > resume with the record append to the table.
> > 
> > 
> > -- 
> > Maurice Ausum
> > 
> > 
> > "Chrism" wrote:
> > 
> > > Hello,
> > > 
> > > I am having a problem creating a msgbox, when data entered through a form 
> > > into a table is duplicated.  I would like for a msgbox to popup, and warn the 
> > > user for dupliucate data, before the actual data is entered into the table.  
> > > I have an index for no duplicate set on a field in a table.  How would I go 
> > > about this?  I have seen code for Jet, and have tried to translate it over to 
> > > ADODB, but with many problems.  Any help with this will be greatly 
> > > appreciated.
> > > 
> > > Thanks
0
Utf
5/29/2007 9:35:02 PM
Reply:

Similar Artilces:

How can I create an invoicing database in Excel?
I would like to know how to create an invoicing database, or register in Excel. (Invoice + tax = total) Are there any templates free online? thanks How about a web search? http://office.microsoft.com/en-us/templates/default.aspx search for invoice -- Regards, Peo Sjoblom (No private emails please, for everyone's benefit keep the discussion in the newsgroup/forum) "Vcollins" <Vcollins@discussions.microsoft.com> wrote in message news:C46E9FE2-0B38-4468-9B00-126B7EE5C9A2@microsoft.com... >I would like to know how to create an invoicing database, or register in &...

sort certain datas in a wide range of datas
Say I have 3 columns with lots of datas: Column A: Order # Column B: Part# Column C: Catergory # A2: Order# 021006 B2: 111 C2: Wire A3: Order# 021006 B3: 222 C3: Machine A4: Order# 021006 B4: 333 C4: Tool A5: Order# 021006 B5: 444 C5: Tape A6: Order# 021007 B6: 222 C6: Machine A7: Order# 021007 B7: 333 C7: Tool A8: Order# 021007 B8: 444 C8: Tape A9: Order# 021008 B9: 111 C9: Wire A10: Order# 021008 B10:222 C10: Machine A11: Order# 021008 B11:555 C11: Bearing What I n...

HowTo add row to series data
1) insert row with ShiftDown 2) apply new data to the newly emptied cells 3) preserve original chart series range 1) after this code row 2 is empty cells Excel.Worksheet chart = (Excel.Worksheet)book.Worksheets["Chart Data"]; Excel.Range rngToday = chart.get_Range("A2", "D2"); rngToday.Insert(Excel.XlInsertShiftDirection.xlShiftDown); 2) this puts todays date into A2 rngToday.NumberFormat = "MM/dd"; rngToday.Value = DateTime.Today; 3) OOPS - the chart data is now A3..A7 because of the insert above How do I reset the souce data to A...

Outlook data files
Can someone tell me and where Outlook saves its data files -- contacts, e-mail, notes, etc. All data is stored in a file with a .PST extension. Look here for all the information you need on backup and restoration of Outlook data: http://www.slipstick.com/config/backup.htm -- Jocelyn Fiorello MVP - Outlook *** Replies sent to my e-mail address will probably not be answered -- please reply only to the newsgroup to preserve the message thread. *** In news:00b301c39beb$88cb98d0$a401280a@phx.gbl, Doug Maples wrote: > Can someone tell me and where Outlook saves its data > files -- co...

Problems creating a newsletter
I chose the form "Newsletter - email". I have created a 3 page newsletter. Now, I have NO IDEA how to send it out as an email. I do not want to send it as an attachment. I cannot figure out which "save as" format or what I need to do so that i can email this newsletter. Is there a website that goes through how to do this? Am I correct when I say that it has to be html in order for me to send it as email? That is not one of the options. Any help you give me would be greatly appreciated. I am using 2003 Publisher. I created the book "Tri-Puzzles for Genesis - I"...

Transposing data from columns to rows
> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3215780710_1600263 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit Hi, I have cut and pasted a table from an online database into a spreadsheet. It has pasted into one column. How can I format the data so that each entry appears in one row across various columns. Currently I am transposing each entry individually by paste special. Help! I have 300 to do! --B_3215780710_1600263 Content-type: text/html;...

xslt: making use of edit/delete buttons is that actually work?
I want to make an xslt file that formats and displays data from an XElement object through an xml control. I need to have the xslt file show edit/remove buttons next to each element/attribute that is displayed on the page. These buttons/links do have to actually work in the sense that you can actually edit/remove the particular element/attribute. Is there any way to do something like this? "Andy B" <a_borka@sbcglobal.net> wrote in message news:uKoP9jvuIHA.4476@TK2MSFTNGP06.phx.gbl... >I want to make an xslt file that formats and displays data from an XElement >...

Creating Duplicate Info
I have five cells of info that need to be added to over 2000 other sku's. Example I have A, B, C, D, E and 1 - 2000 I need it to be 1A, 1B, 1C, 1D, 1E, 2A, 2B etc. I was wondering is there a faster way instead of insterting 5 lines 2000 times? -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.aspx/ms-excel/201003/1 You can do it easily with code. Sub AAA() Dim Letters(1 To 5) As String Dim LNdx As Long Dim N As Long Dim RowNum As Long Letters(1) = "A" Letters(2) = "B" Letters(3) = "C" ...

Something destroying Money data
My MS Money 2007 software was working fine, and then a few months ago, there were transactions missing. I went for backups, and it seemed every time I opened a MOney file there were fewer transactions--it was truly weird. Thinking a file had been accidentally deleted, I used a file recovery program and retrieved file and backup - also no data. So I just put the whole thing aside and out of mind, but tried again today and searched all partitions for mny and mbf files.. Same result, if anything fewer transactions. Is there some virus or other malware that eats Money files? I guess I can d...

XML into DataSet
Hi. I need some help. I have an xml file what will contain hundreds of groups and will have an associated xsd. My overall goal is to have a web application that allows a user to input a groupID from a webform, the application will than find that groupID in the xml file and display all the related information for that group only. I have read my xml into a DataSet and have been able to successful find groupID and display some of the information for that particular group. But I have been unable to navigate to the groupsItems node and subsequently the details of each groupItem found in gro...

How to create "Space Bar hit" action setting?
Hello All, I have this slide with a long animation on a slide that is off mousclick transition. With a hit on the space bar the animation jumps to end. As the presentation is with mouse controlled navigation I do not want users to use the space bar (or they start hitting through the slide sequence) to end the animation. So, is there a way to 'end animation sequence' (like a space bar hit) as an action setting on an object? Thanx, Guurt ...

Excel example-formula C4+C5 adds before data in C5 Can I get it t.
I'm trying to create a formula (for example): In cell D5 I want it to add C4+C5. I would like it to work only after there is data in C5, but not before. How can I get it to work only when there is data in C4 & C5? Right now its showing what I have in C4. =if(count(c4:c5)<2,"Not enough values!",c4+c5) New Excel User wrote: > > I'm trying to create a formula (for example): > In cell D5 I want it to add C4+C5. I would like it to work only after there > is data in C5, but not before. How can I get it to work only when there is > data in C4 & C5? R...

Change paths to linked external data
Hello. I have a database that has 3 external links in it: 1 is to a table in another Access Database. One is to an excel spread sheet. And, the third is to a .csv file. Is there a way in VBA to change the paths to these? Basically, i want to set up a form where the user can specify the new paths in text boxes if any of these files are moved. Anybody help me out? (Access 2007) cyb3rwolf wrote: >Hello. I have a database that has 3 external links in it: 1 is to a table >in another Access Database. One is to an excel spread sheet. And, the third >is to a .csv...

I am using Windows Live Mail
I just downloaded my MSN office but my windows live e-mail account keeps not sending out emails. Email account does not log me after the ID check. How can I reset the protocal correctly to accept the mail portal? Ask in a vista.mail group, WLM has nothing to do with the Outlook group you posted to "jderr" <jderr@discussions.microsoft.com> wrote in message news:22B228D8-DCBF-49BD-9214-EA5E6018A364@microsoft.com... > I just downloaded my MSN office but my windows live e-mail account keeps > not > sending out emails. Email account does not log me after t...

XL 2007 : Noty able to move data values in XY Scatter chart
Hi All, In Excel 2003 I can move data values (scattered points) in XY Scatter chart however this functionality is not working in Excel 2007. Any help? Tushar - Search Google for "excel 2007 deprecate chart" and one of the results is http://blogs.msdn.com/excel/archive/2006/08/28/724641.aspx which says "Direct Manipulation of Data Points on Charts In Previous versions of Excel, data points on a chart could be dragged, resulting in their source values being changed on the worksheet. This seldom used feature has been deprecated for Excel 2007." - Mike http://www...

how to use the type member in System.Web.Services.Description
hi all, I want to parse the wsdl file . It is ease to parse the parts of wsdl except that the part of types. Because I don't know how to use the System.Web.Services.Description member types . I have searched the MSDN to find answer , but , it tell me very less. So I come here for help. For example, there is a types is defined as follows: - <types> - <s:schema elementFormDefault="qualified" targetNamespace="http://www.webservicex.net"> - <s:element name="GetGeoIP"> - <s:complexType> - <s:sequence> <s:element minOccurs="0...

Breaking Formulas using Pivot Table
I have Tab1 that has data in it in the form of a pivot table. I then have another sheet, Tab2, that pulls data from Tab1. This all works, but when I try to copy Tab2 into a new workbook (so that I can e-mail only that tab) a bunch of my formulas in Tab2 fail. If I refresh the pivot tables they work again or if I do a Replace "=" with "=" it seems to trick it into working (but some percent formatting changes to dollar formatting for some reason). I just want to know if there is an easy way to make the new workbook without breaking the formulas in my old one. Thanks in adv...

Creating a batch file for Inventory Adjustments
I'd like to import the results of our physical inventory into an Inventory Adjustment batch. Can someone explain how to do this? The batch will consist of approx 1,000 records. Are you using a stock count schedule? if so, there is no way to do this directly. You could directly import the data into the SQL table - Ask your partner for assistance in this if you are not a DBA. HS "MrMark" <MrMark@discussions.microsoft.com> wrote in message news:B88E26CD-2503-4844-9AA9-94003208556A@microsoft.com... > I'd like to import the results of our physical inventory into...

UI Data Validation using XML Schema
Has anybody done UI data validation usinf XML Schemas. Any pointers will help. Thanks! ...

Using an office program to replace an adding machine and tape
Our business uses adding machines on desks next to computers to create balancing tapes involving counting cash and checks (bookkeeping). Is there a program in office that can replace these conventional adding machines, creating a print out tape as well? Someone said that excel's formula function taxcal may be used for this, does anyone know what the best way it? Thank-you! On Tue, 23 Oct 2007 17:24:01 -0700, jimtmcdaniels <jimtmcdaniels@discussions.microsoft.com> wrote: >Our business uses adding machines on desks next to computers to create >balancing tapes involving c...

Outlook 2007 wont send emails when using contacts
If i select people in my contacts to send out an email, it wont send. It just gives me a parameter error. But, if i manually type the same email, it will work. I looked in the contacts, and the email addresses are correct. I did notice, however, that when i select a contact, outlook puts ' ' around the addresses. When i removed the ' ' it works. Could this be the issues? If so, how do i fix this? You didn't specify the method used for recipient selection. How were these Contacts created? Are their email addresses resolved? -- Russ Valentine "turbowrx...

create an update query
How do I update the disount field for all customers who do not already have a discount? On Sun, 11 Apr 2010 17:15:01 -0700, kim <kim@discussions.microsoft.com> wrote: >How do I update the disount field for all customers who do not already have a >discount? You can see your table structure - we cannot. Guessing that there is a field in the table Customers named Discount, you can create an update query with a criterion Is Null on the discount field to find all records with blank (empty) discounts. If the discount defaults to 0 you can use a criteron =0 ...

Macro to create folder in PST file
I have leveraged a macro I found online to create a new folder underneath the default Inbox, with a name entered by the user. However, what I REALLY want is to create the new folder under a folder that lives in another PST. So instead of: Mailbox --Inbox ----New Folder Users PST --Project I want it to be created as follows: Mailbox --Inbox Users PST --Project ----New Folder Here is the code I have so far - can anyone help? Dim myolApp As Outlook.Application Dim myNamespace As Outlook.NameSpace Dim myFolder As Outlook.MAPIFolder Dim myNewFolde...

Can We Use "cout" in MFC? How About "string"?
How do we use "cout" in MFC. How about string maria("lennox")? None of them works. Please explain; maria Why in the world would you want to? Where do you think it is going to put it? For debug tracing, see my Logging Listbox Control on my MVP Tips site. joe On Thu, 28 Aug 2003 21:19:44 -0400, maria <<>> wrote: >How do we use "cout" in MFC. How about >string maria("lennox")? >None of them works. Please explain; > >maria Joseph M. Newcomer [MVP] email: newcomer@flounder.com Web: http://www.flounder.com MVP Tips: http:...

How to set "Archive items in this folder using the default settings" for all folders and subfolders at once?
Hello How to set "Archive items in this folder using the default settings" for all folders and subfolders at once? I have too many folders and subfolders to set for every folder manually. Version is 2002 sp3. Go to Tools\Options\Other\Autoarchive There is a button titled "Apply these settings to all folders now" Warning!!! This will make ALL folders have the same archive settings, so if you have different subfolders set-up to go to a different archive file or have any sub-folder set to do anything different, you must manually go to that folder and reset it if this is...