473,385 Members | 1,324 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Error 2001: You Canceled the Previous Operation

48
** Admin Edit - Split from Login Forms **
Assuming your password is set to a default like "Password".

You don't say if the username is entered freely or chosen from a dropdown list. I'm assuming it's entered freely (txtUser for this example).

In the textbox where the password is entered (txtPassword for this example) create an After Update event using the following code.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub txtPassword_AfterUpdate()
  3. Dim pswd As String
  4. Dim confirm As String
  5.  
  6.   pswd = DLookup("[PasswordField]","TableName", "[UserNameField]='" & Me.txtUser & "')"
  7.  
  8.   If pswd = "password" Then
  9.  
  10. EnterPassword:
  11.  
  12.     pswd = InputBox "Please enter a new password", "Change Password"
  13.     confirm = InputBox "Please enter again for confirmation", "Confirm Password"
  14.     If pswd <> confirm Then
  15.      MsgBox "Passwords don't match. Please try again.", vbOKOnly
  16.      GoTo EnterPassword
  17.     Else
  18.      DoCmd.RunSQL "UPDATE tablename SET [passwordfield]= '" & Me.pswd & "' WHERE [UserNameField]='" & Me.txtUser & "';"
  19.     End If
  20.   Else
  21.      'Your normal password checking code here
  22.   End If    
  23.  
  24. End Sub
  25.  
  26.  
hi i need to do the exact same thing that you've done in your code for changing the password. its the same scenario like you've stated. txtpassword and the user types their own user name in txtusername. i have a table with the list of user names and their passwords and the log in executes properly.Now i need to give them the option of changing their passwords.
i ran the code and i keep getting an runtime error 2001: You cancelled the previous operation, in the following line:
Expand|Select|Wrap|Line Numbers
  1. pswd = DLookup("[Password]", "tblUsers", "[Username]=" & Me.txtUsername)
any idea how i can fix this?
Sep 24 '08 #1
5 1987
NeoPa
32,556 Expert Mod 16PB
You have asked your question in another member's thread. This is called thread hijacking and is not allowed on this site. There are various reasons for this, the principal of which is that it typically diverts the flow of the thread away from their needs and into yours. Another is that it will tend to mean that your new question is not seen as such, and may get overlooked by many of our experts (You appreciate that they're not looking for answered questions).
Please post your questions in their own threads in future (See How to Ask a Question).

Administrator.
Sep 24 '08 #2
I'm assuming your Password field is a text field, if that's the case try changing the code to be

Expand|Select|Wrap|Line Numbers
  1. pswd = DLookup("[Password]", "tblUsers", "[Username]='" & Me.txtUsername & "'")
Using the ' around the username should fix it. another option is

Expand|Select|Wrap|Line Numbers
  1. pswd = DLookup("[Password]", "tblUsers", "tblUsers.[Username]='" & Me.txtUsername & "'")
Not sure why the 2nd one will sometimes work and the first one won't.
Sep 24 '08 #3
zandiT
48
You have asked your question in another member's thread. This is called thread hijacking and is not allowed on this site. There are various reasons for this, the principal of which is that it typically diverts the flow of the thread away from their needs and into yours. Another is that it will tend to mean that your new question is not seen as such, and may get overlooked by many of our experts (You appreciate that they're not looking for answered questions).
Please post your questions in their own threads in future (See How to Ask a Question).

Administrator.
sorry about that, it wont' happen again in future
Sep 25 '08 #4
NeoPa
32,556 Expert Mod 16PB
No big problem if it doesn't happen again :)

Is your problem solved now by the way?
Sep 25 '08 #5
NeoPa
32,556 Expert Mod 16PB
Actually, I just had this problem myself looking at somebody else's problem yesterday.

I found that this occurs from within a Domain Aggregate (DLookup(), DMin(), DMax(), etc) function call if the call is not set up correctly.

Try tracing through and seeing if you can find what is not right in your DLookup() line.
Sep 25 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: RWC | last post by:
Hi, I'm running into a problem with Access XP (SP2) that's driving me up the wall. It's Error 2001 "You canceled the previous operation". There is no voodoo going on really when I get this...
10
by: DataBard007 | last post by:
Hello Access Gurus: I use Win98SE and Access97. I just built a simple Access97 application which holds all contact information for my personal contacts, such as first name, last name, address,...
1
by: John A. | last post by:
This is a database in use on Terminal server, been reliable, no corruption problems. (so far) Designing a form, asked to save objects, Access put up a dialog box for the current form asking me...
5
by: Susan Bricker | last post by:
Greetings! Can you help me? Here's the error: “Run-time error ‘2001’. You canceled the previous operation.” Here's the form description: has 2 controls involved with this error: =...
1
by: Tempy | last post by:
Good day, I have put the below into Module1 and get an error message "Run-Time error '2001'" "You canceled the previous operation". Can anybody tell me what is wrong ? Sub test() Dim varX As...
4
by: sparks | last post by:
If Not IsNull(DLookup(, "tblDemographic", " = """ & Me.Text9 & """")) Then Cancel = True MsgBox "Duplicate Value is Not Allowed" ActiveControl.Undo DoCmd.RunCommand acCmdUndo End If I try to...
20
by: Crayola465 | last post by:
I have been trying to figure this out for a couple weeks and after reading every post in the forum about the subject I have not found anything that works. I have two tables; 1) has company...
4
by: schiu1010 | last post by:
I am very confused for this error. I was just try to put a dynamic filter on a query. The error comes after I did this: 33 me.filter = " = '2005' " 34 me.filterOn = (me.filter > "") ...
3
by: ramprat | last post by:
Hi Sorry to keep asking questions but I keep getting a run-time error 2001 "you canceled the previous operation" error whenever the code in the Dlookup line is reached. I have a table called...
3
by: AccessBeetle | last post by:
I am creating simple login form with linked tables(atual tables are in SQL 2005) in access 2003. Here is my code. Option Compare Database Private Sub cmdSignIn_Click() 'Check to see if data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.