** 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. -
-
Private Sub txtPassword_AfterUpdate()
-
Dim pswd As String
-
Dim confirm As String
-
-
pswd = DLookup("[PasswordField]","TableName", "[UserNameField]='" & Me.txtUser & "')"
-
-
If pswd = "password" Then
-
-
EnterPassword:
-
-
pswd = InputBox "Please enter a new password", "Change Password"
-
confirm = InputBox "Please enter again for confirmation", "Confirm Password"
-
If pswd <> confirm Then
-
MsgBox "Passwords don't match. Please try again.", vbOKOnly
-
GoTo EnterPassword
-
Else
-
DoCmd.RunSQL "UPDATE tablename SET [passwordfield]= '" & Me.pswd & "' WHERE [UserNameField]='" & Me.txtUser & "';"
-
End If
-
Else
-
'Your normal password checking code here
-
End If
-
-
End Sub
-
-
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: - pswd = DLookup("[Password]", "tblUsers", "[Username]=" & Me.txtUsername)
any idea how i can fix this?
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.
I'm assuming your Password field is a text field, if that's the case try changing the code to be - pswd = DLookup("[Password]", "tblUsers", "[Username]='" & Me.txtUsername & "'")
Using the ' around the username should fix it. another option is - pswd = DLookup("[Password]", "tblUsers", "tblUsers.[Username]='" & Me.txtUsername & "'")
Not sure why the 2nd one will sometimes work and the first one won't.
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
NeoPa 32,556
Expert Mod 16PB
No big problem if it doesn't happen again :)
Is your problem solved now by the way?
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.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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,...
|
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...
|
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:
=...
|
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...
|
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...
|
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...
|
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 > "") ...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
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...
|
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...
| |