472,119 Members | 1,792 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

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 1517
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

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.