Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Code Question.........

Discussion in 'Information Technology' started by Code Agent, Jul 28, 2006.

Tags:
  1. Code Agent

    Code Agent
    Expand Collapse
    Guest

    Is there a way to have code pop up a warning to tell me that I am duplicating
    something?
    ex. If I enter info in fields, "House #", "Street", "Violation", "Status",
    and at a later date enter in the exact same info, I would like it to ask me
    if I want to duplicate it. Any help would be greatly appreciated.
     
  2. Loading...

    Similar Threads Forum Date
    Introducing The Spn Code Of Forum Etiquette Announcements Feb 20, 2016
    UK Sikh 'code of silence' on sexual grooming Breaking News Sep 2, 2013
    Can a Dress Code Bar Ethnic and Religious Attire Based on Customer Preferences in the US? Questions and Answers May 3, 2011
    Pacific Code Exempts Religious Drivers (Fiji) Breaking News Feb 16, 2011
    Controversial Gurdwaras 'Breaking the Sikh Code' on Meat and Alcohol Hard Talk Dec 2, 2010

  3. Rick Wannall

    Rick Wannall
    Expand Collapse
    Guest

    If you create an index on the fields of interest, and make it a unique
    index, it would prevent the problem, although the error message is not very
    informative. If you want to do this, open the table in design view, click
    View and then Indexes. In the popup index display, go to the last blank
    line. Type a new index name, then move to the center column and put each
    field name you care about in the index.

    If you're OK with DLOOKUP etc. operations, you can have a field on your data
    entry form that is bound to an expression such as this:

    =dcount("*", "mytable", "house='" & me.txthouse & "' And Street = '" &
    Me.txtstreet & "' etc etc etc")

    Of course, replace etc etc etc with the rest of your criteria. What you
    want is that the field bound to this expression would always be 0. If after
    entering data in one of the fields the count becomes anything other than 0
    (presumably 1) you could notice that and stop your entry.

    If you're good with code behind the form, you could cause your form to check
    the field, using the AfterUpdate event of each of the controls used for the
    fields you're monitoring.

    There's a lot more you could look at, but if any of these works for your
    situation then you're good to go.
     

Share This Page