By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,466 Members | 1,756 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,466 IT Pros & Developers. It's quick & easy.

how to update new password to existing table in a custom login form using macros or query?

P: n/a
Hi, i am currently working on a project which requires me to create a
form to allow the user to change their password.

I know there is a user-level security login which is easier and safer
but was told that i could and even must not use it. GOD KNOWS WHY

So i created a custom login form with userID and password which
validates with a table containing all the users and their passwords.

Then, i thought it would be easier to allow the user to change their
password as they like by creating another form called "frmUpdatePW".

frmUpdatePW consists of 4 textbox:

-UserID
-Old Password
-New Password
-Confirm Password

& a command button
-cmdChangePW

i can validate whether userID matches with old password, but am stuck
at how to ensure the new password is entered into the table containing
the userID and password.

Can i use an update query to do so? and if its possible, how would i go
about doin dat?
Becoz i am still a newbie with access, i was wonderin is there even a
simpler way to update new password to existing table using forms. Can i
do without any modules or codes?

Thanks alot..i realli appreciate ur help..

Jan 4 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
The SQL for your UPDATE query would be:
UPDATE tblUsers SET tblUsers.Password='" & txtNewPassword & "' WHERE
tblUsers.UserID='" & txtUserID & "'";

Note that there are single quotes outside of the double quotes.

You COULD do this by binding frmUpdatePW to tblUsers and binding your
Confirm Password textbox to the Password field in tblUsers. However,
this is a poor way to accomplish this task.

I would stick a DoCmd.RunSQL with the above SQL statement in the Click
event of cmdChangePW.

Jan 4 '06 #2

P: n/a
"Nerrad" <Ye********@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
Hi, i am currently working on a project which requires me to create a
form to allow the user to change their password.

I know there is a user-level security login which is easier and safer
but was told that i could and even must not use it. GOD KNOWS WHY

By whom? I'm willing to bet that it was a manager who *thinks* he knows
what he's talking about but doesn't. User-level security has a steep
learning curve and isn't unbreakable but is, IMO, infinitely better than a
'roll your own' solution.

Just my 2p worth :-)

Keith.
www.keithwilby.com
Jan 4 '06 #3

P: n/a
thanxs for that..but i encounter another problem

i have three tables containing the userIDs and passwords for three
different level of access/ permission for different users. And the
above SQL would not work as it has only one table to update.

As i stick a macro in the click event of cmdChangePW (to verify
authencity of UserID and password/ to check whether textbox of new PW
and confirm PW are the same), if i were to add in the DoCmd.RunSQL in
the macro, would it be a problem.

Thanks loads, man!

Jan 5 '06 #4

P: n/a
My Update query SQL looks like this and access is giving me problems by
saying there is a syntax error in the query expression. What is wrong?
Can anyone help me? Lotsa thanxs in advance!
UPDATE tblPasswordReceivi
SET tblPasswordReceivi.Password = '" & txtConfirmPW & "' WHERE
tblPasswordReceivi.UserID ='" & txtusername & "'";

OR

UPDATE tblPasswordPurchase
SET tblPasswordPurchase.Password & txtConfirmPW & "' WHERE
tblPasswordPurchase.UserID ='" & txtusername & "'";

OR

UPDATE tblPasswordMgmt
SET tblPasswordMgmt.Password & txtConfirmPW & "' WHERE
tblPasswordMgmt.UserID ='" & txtusername & "'";

Jan 5 '06 #5

P: n/a
You're missing quotes after Password in the last two. They should be:

UPDATE tblPasswordPurchase
SET tblPasswordPurchase.Password='" & txtConfirmPW & "' WHERE
tblPasswordPurchase.UserID ='" & txtusername & "'";

Also check for nulls in txtConfirmPW and txtusername.

Jan 5 '06 #6

P: n/a
thanxs once again for ur help, realli appreciate it..
however i got another problem..
Here's what i did..
i created a macro at the on-click event (macroChangePW);
i created conditions to check whether any of the textboxes were null;
i verified whether the userID is correct with the passwords in their
respective tables;
i created three different actions, running the 3 SQLs respectively

1)
UPDATE tblPasswordReceivi
SET tblPasswordReceivi.Password = '" & txtConfirmPW & "' WHERE
tblPasswordReceivi.UserID ='" & txtusername & "'";

2)
UPDATE tblPasswordPurchase
SET tblPasswordPurchase.Password='" & txtConfirmPW & "' WHERE
tblPasswordPurchase.UserID ='" & txtusername & "'";

3)
UPDATE tblPasswordMgmt
SET tblPasswordMgmt.Password='" & txtConfirmPW & "' WHERE
tblPasswordMgmt.UserID ='" & txtusername & "'";
The problem is that when i want to change my password, the password was
not changed when i checked the table containing the userIDs and
password. Is something wrong here? Would it be helpful if i sent a
screen-shot of the macro if any kind soul could help me? I'm realli a
newbie at this..

Thnx lotsa..

Jan 11 '06 #7

P: n/a
thanxs once again for ur help, realli appreciate it..
however i got another problem..
Here's what i did..
i created a macro at the on-click event (macroChangePW);
i created conditions to check whether any of the textboxes were null;
i verified whether the userID is correct with the passwords in their
respective tables;
i created three different actions, running the 3 SQLs respectively

1)
UPDATE tblPasswordReceivi
SET tblPasswordReceivi.Password = '" & txtConfirmPW & "' WHERE
tblPasswordReceivi.UserID ='" & txtusername & "'";

2)
UPDATE tblPasswordPurchase
SET tblPasswordPurchase.Password='" & txtConfirmPW & "' WHERE
tblPasswordPurchase.UserID ='" & txtusername & "'";

3)
UPDATE tblPasswordMgmt
SET tblPasswordMgmt.Password='" & txtConfirmPW & "' WHERE
tblPasswordMgmt.UserID ='" & txtusername & "'";
The problem is that when i want to change my password, the password was
not changed when i checked the table containing the userIDs and
password. Is something wrong here? Would it be helpful if i sent a
screen-shot of the macro if any kind soul could help me? I'm realli a
newbie at this..

Thnx lotsa..

Jan 11 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.