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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|