A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

duplicate fields on table



 
 
Thread Tools Display Modes
  #1  
Old June 15th, 2009, 10:57 PM posted to microsoft.public.access.tablesdbdesign
RUBEN
external usenet poster
 
Posts: 39
Default duplicate fields on table

I am assigning a number to each person on the table but do not want that
number to duplicate. After entering all the information of that person which
is about 10-12 fields before going to the next record i will get that error
message saying that i just duplicated a field. Is there a way to catch the
duplicate before entering the whole information on all fields?
  #2  
Old June 16th, 2009, 12:00 AM posted to microsoft.public.access.tablesdbdesign
Graham Mandeno
external usenet poster
 
Posts: 593
Default duplicate fields on table

Hi Ruben

Use the BeforeUpdate event of the textbox where you are entering the number.
Your code should use DLookup to check for the existence of that number in
the existing records:

If Not IsNull( DLookup( "YourFieldName", "YourTableName", _
"[YourFieldName]=" & YourTextboxName ) Then
MsgBox "That number has already been used"
Cancel = True
End If

Do the numbers have any particular meaning? If not, then why not make that
field an AutoNumber and Access will take care of everything for you.

--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

"Ruben" wrote in message
...
I am assigning a number to each person on the table but do not want that
number to duplicate. After entering all the information of that person
which
is about 10-12 fields before going to the next record i will get that
error
message saying that i just duplicated a field. Is there a way to catch the
duplicate before entering the whole information on all fields?



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:43 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.