473,779 Members | 2,001 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Replacing table value with different value in VB

6 New Member
Here is the problem. I have made a log in script that prompts you to log in with a username and password as the "splash screen" It is an unbounded forum that checks that the username and password are in the employee table, and that they are together, and if it is, it lets you log on. That works just fine. Then i tried to make a form that you can change your password if you please. It has 4 entrys, the user name, password, and then2 of the "new password" if the username and password match the table, and the two new passwords are identical, then it OKs you to proceed. That is where i am getting stuck. I have the table with three fields - and employee number (auto), the employee name, and the password. i cannot figure out how to get the new password to replace the old password without creating a new entry.

here is my script for the password change form. :)

Option Compare Database

Private Sub Cancel_Click()
On Error GoTo Err_Cancel_Clic k


DoCmd.Close


Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Home Page"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Cancel_Cli ck:
Exit Sub

Err_Cancel_Clic k:
MsgBox Err.Description
Resume Exit_Cancel_Cli ck

End Sub



Private Sub Change_Click()

'Check to see if data is entered into the UserName combo box

If IsNull(Me.Combo 13) Or Me.Combo13 = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.Combo13.SetF ocus
Exit Sub
End If

'Check to see if data is entered into the password box

If IsNull(Me.OldPa ss) Or Me.OldPass = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.OldPass.SetF ocus
Exit Sub
End If

'Check to see if data is entered into the New Password combo box

If IsNull(Me.NewPa ss) Or Me.NewPass = "" Then
MsgBox "You must enter a New Password.", vbOKOnly, "Required Data"
Me.NewPass.SetF ocus
Exit Sub
End If

'Check to see if data is entered into the Confirm Password box

If IsNull(Me.Confi rmPass) Or Me.ConfirmPass = "" Then
MsgBox "You must ReEnter the New Password.", vbOKOnly, "Required Data"
Me.ConfirmPass. SetFocus
Exit Sub
End If



'Confirm Old Password Matchs UserName

If Me.OldPass.Valu e = DLookup("strEmp Password", "tblEmploye es", "[lngEmpID]=" & Me.Combo13.Valu e) Then

lngMyEmpID = Me.Combo13.Valu e


Else

MsgBox "Existing Password does not match User Name. Contact Administrator", vbOKOnly, "Security Alert"
Me.OldPass.SetF ocus
Exit Sub

End If




'Check value of password in tblEmployees to see if this
'matches value chosen in combo box

If Me.NewPass.Valu e <> Me.ConfirmPass. Value Then

MsgBox "New Passwords Do Not Match", vbOKOnly, "Security Alert"
Me.NewPass.SetF ocus
Exit Sub

End If


'Replace Old Password with New Password

STUCK HERE







'Open Home Page and Close logon form

MsgBox "Password Successfully Changed", vbOKOnly, "Security Alert"

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Home Page"
DoCmd.OpenForm stDocName, , , stLinkCriteria

DoCmd.Close acForm, "ChangePass ", acSaveNo


End Sub

:) Here is my script for the login box

Private Sub cboEmployee_Aft erUpdate()

'After selecting user name set focus to password field

Me.txtPassword. SetFocus

End Sub


Private Sub Command6_Click( )

'Check to see if data is entered into the UserName combo box

If IsNull(Me.cboEm ployee) Or Me.cboEmployee = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.cboEmployee. SetFocus
Exit Sub
End If

'Check to see if data is entered into the password box

If IsNull(Me.txtPa ssword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword. SetFocus
Exit Sub
End If

'Check value of password in tblEmployees to see if this
'matches value chosen in combo box

If Me.txtPassword. Value = DLookup("strEmp Password", "tblEmploye es", "[lngEmpID]=" & Me.cboEmployee. Value) Then

lngMyEmpID = Me.cboEmployee. Value

'Close logon form and open splash screen

DoCmd.Close acForm, "Login", acSaveNo
DoCmd.OpenForm "SplashScre en"

Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtPassword. SetFocus


End If







'If User Enters incorrect password 3 times database will shutdown

intLogonAttempt s = intLogonAttempt s + 1
If intLogonAttempt s > 3 Then
MsgBox "You do not have access to this database.Please contact admin.", vbCritical, "Restricted Access!"
Application.Qui t
End If

End Sub
Private Sub Command16_Click ()
On Error GoTo Err_Command16_C lick


DoCmd.Close

Application.Qui t

Exit_Command16_ Click:
Exit Sub

Err_Command16_C lick:
MsgBox Err.Description
Resume Exit_Command16_ Click

End Sub
Private Sub ChngPass_Click( )
On Error GoTo Err_ChngPass_Cl ick

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "ChangePass "
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_ChngPass_C lick:
Exit Sub

Err_ChngPass_Cl ick:
MsgBox Err.Description
Resume Exit_ChngPass_C lick

End Sub


:)

The login box works fine.

the three tables are :

IngEmpID === Employee Auto Number
strEmpName ==== Employee Name
strEmpPassword === Employee Password

any help would be awesome, i have been stuck all day

thanks alot,

Bill
Jul 28 '06 #1
1 4189
amraam35
6 New Member
to make it a little more clear, im looking for some type of script that will tell it to replace (strEmpPassword ) (which is an entry in a table record) - the one for the username which was entered above - with (ConfirmPass) - the new password which was entered on the form and as of yet has not been stored in a table.

I have tried the replace() function, that just changed letters in a script.


Thanks again
Jul 28 '06 #2

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

Similar topics

8
1606
by: jamesfin | last post by:
Dear XMLers, Please guide me... I have a simple xml file... <URLTest>
7
1732
by: Rob Meade | last post by:
Hi all, Been a long time since I've been here... /me waves to all.. Ok - my conundrum.. I have a form where a user can enter text and BB codes...for example:
3
5729
by: dumbledad | last post by:
Hi All, I'm confused by how to replace a SELECT statement in a SQL statement with a specific value. The table I'm working on is a list of words (a column called "word") with an index int pointing to the sentence they come from (a column called "regret"). I also have a table of stop words (called "GenericStopWords") that contains the words I do not want to consider. That table has a single column called "word". I started off using a...
16
2465
by: StenKoll | last post by:
Help needed in order to create a register of stocks in a company. In accordance with local laws I need to give each individual share a number. I have accomplished this by establishing three tables (se below) then I run a query giving me a running total, which give me the first stock in the batch purchased by an individual, then I use this number and add the number of shares in order to find the number of the individuals' last share. So...
12
5928
by: Adam J. Schaff | last post by:
I am writing a quick program to edit a binary file that contains file paths (amongst other things). If I look at the files in notepad, they look like: <gibberish>file//g:\pathtofile1<gibberish>file//g:\pathtofile2<gibberish> etc. I want to remove the "g:\" from the file paths. I wrote a console app that successfully reads the file and writes a duplicate of it, but fails for some reason to do the "replacing" of the "g:\". The code...
35
5836
by: jacob navia | last post by:
Hi guys! I like C because is fun. So, I wrote this function for the lcc-win32 standard library: strrepl. I thought that with so many "C heads" around, maybe we could improve it in a collective brainstorming session. Let's discuss some C here, for a change :-)
4
1521
by: niftyhawk | last post by:
Hi All, I have the HTML in "Output A" generated dynamically and stored in a PHP variable say $contents. I want this to parse and insert checkboxes in the code which have to look like "OUTPUT B". The checkbox value should be the value of "query=" in the "href tag". OUTPUT A
11
2097
by: Weston Weems | last post by:
I've got the need to have user information for logged in user in a readily avaliable page context (a lot like how Profile is) except not suck. Before we jump to any conclusions, from what I gathered, the implementation of the provider model is absolute garbage. While I've seen microsoft employees make other questionable design decisions, I cant possibly fathom why a user profile cant be derived as some other object.
1
2353
by: gViscardi | last post by:
Hello all, Ok, so what I am attempting to accomplish is to replace my table-based website with a CSS layout site, but I have run into a few hitches. My main problem is that currently my website has sliced images that form the frame around some text, I take those slices and put them into a table and everything comes out fine. My table has three rows, the first row has 5 cells, each containing a piece of the frame, with the 2nd cell...
0
9632
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10302
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10136
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9925
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8958
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7478
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3631
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.