I have written a DBMS program that has a login screen to access the database.
It asks for username and password and enters the DB.
I want to make a provision where if the user forgets his password, the login details (username - password ) are sent to his/her email address .
It should work like this. The user clicks on a button called "Forgot Password". Then a form opens, with a textbox prompting the user to enter his/her email address. The login details are retrieved and sent to the email at the click of a button called retrieve.
Below is the code for the login screen . Any help will be appreciated.
Code:Private Sub cmdLogin_Click() Dim un As String Dim ps As String adodc1.Refresh un = Text1.Text 'storing the login and password entered in the variables un and ps ps = Text2.Text Do Until adodc1.Recordset.EOF If adodc1.Recordset.Fields("name").Value = un And adodc1.Recordset.Fields("password").Value = ps Then mn.Show 'comparing database values with values entered login.Hide Exit Sub Else adodc1.Recordset.MoveNext 'moving to next record on database End If Loop Dim msg As String msg = MsgBox("Username/password mismatch.Passwords are case sensitive! Try Again!", vbOKCancel) If (msg = 1) Then 'displays message if login or password login.Show 'is wrong Text1.Text = "" 'clears the textboxes Text2.Text = "" 'reloads login screen Text1.SetFocus Else MsgBox " Thank you for using LussoVoyageur Car rental software", , "Good Bye" End End If End Sub Private Sub Command1_Click() PassEmail.Show End Sub Private Sub Form_Resize() With Me .Width = Screen.Width .Height = Screen.Height .Top = 0 .Left = 0 End With End Sub




Reply With Quote