Computing.Net > Forums > Windows XP > Access 2003 = Run-Time Error 2001

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Access 2003 = Run-Time Error 2001

Reply to Message Icon

Name: jpguilbeau
Date: June 28, 2005 at 01:37:09 Pacific
OS: Windows XP Professional S
CPU/Ram: 512 Mb
Comment:

Hello from Belgium,

In Office Access 2003, I am building an application in which there is a table (tblEmployees) to enter the identification of the employees working in a company.
I am trying to avoid duplicate records by searching the existence or the absence of a duplicate Last Name in the [Last Name] field. I created a VBA code to capture and verify the Last Name but I am facing a problem that I do not find how to solve it as I have verified every single word of my code. Here follows the code:

Private Sub LastName_AfterUpdate() 'LastName being the name of the control for inputting the Last Name
Dim Check As Integer
Dim MsgString As String
Check = DCount("[Last Name]", "tblEmployees", "[Last Name]='" & Me![LastName] & "'")
If Check <> 0 Then
MsgString = ""
MsgString = MsgString & "That " & FieldToCheck & " "
MsgString = MsgString & "has already been used!" & Chr(13)
MsgString = MsgString & "Duplicates are unauthorized!"
Me.Undo
Me.Undo
End If
End Sub

Every time, I am trying to run the application, when the LastName_AfterUpdate event is called, I keep receiving a Run-time Error '2001' stating "You canceled the previous operation". Of course, there is nothing in the help file to explain me what is going on.

Could you please help me?

Thanks beforehand,

Mr. Guilbeau



Sponsored Link
Ads by Google

Response Number 1
Name: Jennifer SUMN
Date: June 28, 2005 at 06:33:30 Pacific
Reply:

If you don't want the last name to be duplicated, why not set that field as the Primary Key? Just wondering though, what happens if a new employee is hired who just happens to have the same last name as a current employee?

Soylent Green is PEOPLE!!!


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Access 2003 = Run-Time Error 2001

Run-time error '13' + pup.exe www.computing.net/answers/windows-xp/runtime-error-13-pupexe/81592.html

IE Run Time Error www.computing.net/answers/windows-xp/ie-run-time-error/147269.html

RUN TIME ERROR? what does it mean? www.computing.net/answers/windows-xp/run-time-error-what-does-it-mean/7825.html