By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,466 Members | 2,140 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,466 IT Pros & Developers. It's quick & easy.

unique data in a table.

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.