Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Database Design / December 2004

Tip: Looking for answers? Try searching our database.

Prevent duplication of records in two fields

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
FreeMaster - 12 Dec 2004 06:23 GMT
Hi,
I need help to prevent duplicating records in two combining fields. Below is
an example of my data base and what I'm trying to do.

Field 1            Field 2
  A                    1
  A                    2
  B                    1
  B                    3
  A                    1 <<<< duplicate combination, shall be prevented.

any ideas ?

Thanks,
WL
'69 Camaro - 12 Dec 2004 06:48 GMT
Hi.

You need to create a unique index on the two fields.  And don't allow null
values in either of these fields, unless both fields are "required."  Even
then, it's easy to trip on the use of nulls when using SQL.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)

> Hi,
> I need help to prevent duplicating records in two combining fields. Below is
[quoted text clipped - 11 lines]
> Thanks,
> WL
FreeMaster - 13 Dec 2004 11:23 GMT
I appreciate your reply.

I tried it but didn't work. It prevents me from entering same data in one
field twice. but that's not what I need. It shall prevent repeating combined
values in two fields.

Thank you,
WL

> Hi.
>
[quoted text clipped - 28 lines]
> > Thanks,
> > WL
'69 Camaro - 15 Dec 2004 13:44 GMT
Hi.

To create a unique index on two fields, open the table in Design View.
Select the first field of your unique index.  Set the "Required" Property to
"Yes."  Select the second field of your unique index.  Set the "Required"
Property to "Yes."

Right click on the Design View Title bar and select the "Indexes" item on
the pop-up menu to open the "Indexes:  MyTableName" dialog window.  In the
"Index Name" column, type a name for the unique index in the first empty
row.  In the "Field Name" column of that row, select the name of the first
field of your unique index.  In the next row of that same column, select
name of the second field of your unique index.

Move the cursor back to the first row of the unique index so that the Index
Properties appears (again).  Change the "Unique" Property to "Yes."  Close
the "Indexes:  MyTableName" dialog window.  Save the table.

This unique index on two fields will prevent users from entering duplicates
of the combined fields.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)

> I appreciate your reply.
>
[quoted text clipped - 37 lines]
> > > Thanks,
> > > WL
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.