473,398 Members | 2,380 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,398 software developers and data experts.

Replacing table value with different value in VB

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_Click


DoCmd.Close


Dim stDocName As String
Dim stLinkCriteria As String

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

Exit_Cancel_Click:
Exit Sub

Err_Cancel_Click:
MsgBox Err.Description
Resume Exit_Cancel_Click

End Sub



Private Sub Change_Click()

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

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

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

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

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

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

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

If IsNull(Me.ConfirmPass) 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.Value = DLookup("strEmpPassword", "tblEmployees", "[lngEmpID]=" & Me.Combo13.Value) Then

lngMyEmpID = Me.Combo13.Value


Else

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

End If




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

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

MsgBox "New Passwords Do Not Match", vbOKOnly, "Security Alert"
Me.NewPass.SetFocus
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_AfterUpdate()

'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.cboEmployee) 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.txtPassword) 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("strEmpPassword", "tblEmployees", "[lngEmpID]=" & Me.cboEmployee.Value) Then

lngMyEmpID = Me.cboEmployee.Value

'Close logon form and open splash screen

DoCmd.Close acForm, "Login", acSaveNo
DoCmd.OpenForm "SplashScreen"

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

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

End Sub
Private Sub Command16_Click()
On Error GoTo Err_Command16_Click


DoCmd.Close

Application.Quit

Exit_Command16_Click:
Exit Sub

Err_Command16_Click:
MsgBox Err.Description
Resume Exit_Command16_Click

End Sub
Private Sub ChngPass_Click()
On Error GoTo Err_ChngPass_Click

Dim stDocName As String
Dim stLinkCriteria As String

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

Exit_ChngPass_Click:
Exit Sub

Err_ChngPass_Click:
MsgBox Err.Description
Resume Exit_ChngPass_Click

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 4170
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
by: jamesfin | last post by:
Dear XMLers, Please guide me... I have a simple xml file... <URLTest>
7
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
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...
16
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...
12
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: ...
35
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...
4
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...
11
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...
1
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...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
0
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...

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.