469,610 Members | 1,494 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,610 developers. It's quick & easy.

unique data in a table.

I have a database, and in it i have a problem.

I have a table, from wich data is entered via a form.

How can i get access to not allow duplicate entrys into the same row.

Eg

I have a space for two names. if you enter Mark into one, and try and enter
mark into the other, i want access to bring up a message box saying
"duplicate name entered."

Do you get what i mean, or do i need to be more descriptive.

Thanks!!
Mark
Nov 12 '05 #1
2 1478
Mark,

You don't need two fields on your form! Go to the database window and the the
tables tab. Open your table in design view. Click on the fieldname where you
enter Mark. Go to the bottom - Field Properties - and click in the Indexed
properties. Select Yes(No Duplicates) in the drop down list. Access will now
throw up an error message when you try to enter a duplicate name in that field
on your form.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"mark solesbury" <ma************@SPAMlineone.net> wrote in message
news:MP*****************@newsfe3-win.server.ntli.net...
I have a database, and in it i have a problem.

I have a table, from wich data is entered via a form.

How can i get access to not allow duplicate entrys into the same row.

Eg

I have a space for two names. if you enter Mark into one, and try and enter
mark into the other, i want access to bring up a message box saying
"duplicate name entered."

Do you get what i mean, or do i need to be more descriptive.

Thanks!!
Mark

Nov 12 '05 #2
In the BeforeUpdate event of the second name text box check that the
value of the first text box is not the same:

IF Me.Name1 = Me.Name2 THEN
MsgBox "Duplicate name entered!"
Cancel = True
END IF

Pavel

mark solesbury wrote:

I have a database, and in it i have a problem.

I have a table, from wich data is entered via a form.

How can i get access to not allow duplicate entrys into the same row.

Eg

I have a space for two names. if you enter Mark into one, and try and enter
mark into the other, i want access to bring up a message box saying
"duplicate name entered."

Do you get what i mean, or do i need to be more descriptive.

Thanks!!
Mark

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Westcoast Sheri | last post: by
7 posts views Thread by Tony Clarke | last post: by
3 posts views Thread by Bob | last post: by
5 posts views Thread by Marie | last post: by
3 posts views Thread by Bruce Wood | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.