Replace data using code

  • Thread starter Peter McCartney
  • Start date
P

Peter McCartney

Hello All! A97 Thanking anyone for assistance.

I have a basic password protected database on 1 computer only. Used by 5
people only in a secured room. It's not really a security issue but being
able to keep a track of whos in the database and whos not, with times &
dates.

The tracking in of users is working well, times & dates in and out etc.due
to the help from this newsgroup. Anyway!

For this I have a table called "Trego" with the fields:
1. ID - autonumber
2. Rego - number
3. Password - text - input mask set to password
4. Name - text

I have put the data in that is required for the above table that covers
these 5 users.

I want the 5 users to be able to change their own password themselves,
instead of me doing it.

The form I am using to change the password is called "fchange"
The fields on it are called, [Rego], [Password] with a unbound text box
called [newpassword].

With code:
************************************************
Private Sub Password_AfterUpdate()
Dim strfilter As String

strfilter = "Password = " & Me!Password
strfilter = "rego = " & Me!rego

If me!password = Dlookup("password", "trego",strfilter) And me!rego =
Dlookup("rego", "trego", strfilter) then

msgbox "ID confirmed. Enter new Password!"

Docmd.GotoControl "Newpassword"

End if
End sub
***********************************************
The user then enters their new password.

The unbound textbox [newpassword] has the code in the afterupdate section

***********************************************
Me!Password = Me!Newpassword
***********************************************

This all works except it adds another record to my table. How can I get
around not adding another record but editing the data already there?

Peter McCartney
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top