Visual Basic/VB6 programming
So many thanks to you for your advice, it is very helpful to me but at present I have a problem,
When the form loading then a message will display on the form,
then Username & Password given by the user for signin. After submission, the system will verify the given name & password are present in the mdb file. If the system not found then a message will display "Do you want to register yourself?-Yes/No/Cancel" if the system matched the given name with the database then the next form will open for further processing otherwise the present form will be closed.
Please sir help me for another time to overcome the problem.
Thanks in advance.
have a form with 3 text boxes 3 labels and 4 buttons.
labels text Username,Password,Retype Password
textboxes txtUsername,txtPassword,txtRepPass .the last two to have passwordchar prop as *
for command buttons, ok, cancel, new user, exit
this is the code:
put check mark on project_references,Microsoft ActiveX dataobjects2.8
Dim conn As ADODB.Connection, rec As ADODB.Recordset, esql As String, LoggedUser As String, rec1 As ADODB.Recordset
Dim loginSucceded As Boolean
Private Sub FormLoad()
Set conn = New ADODB.Connection
Set rec = New ADODB.Recordset
Set rec1 = New ADODB.Recordset
conn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "Login.mdb;Persist Security Info=False")
'put the mdb file in same directory as the vb project file. it must have fields user name, password
'change the path
Private Sub cmdCancel_Click()
loginSucceded = False
Private Sub cmdOK_Click()
If txtUserName.Text = "" Or txtPassword = "" Then Exit Sub
If tRepPass.Text <> txtPassword.Text Then
MsgBox ("Passwords don't match")
esql = "select * from Users where Username=" & "'" & txtUserName & "'"
esql = esql & " And password=" & "'" & txtPassword & "'"
rec.Open (esql), conn, adOpenStatic, adLockReadOnly
If rec.RecordCount > 0 Then
LoggedUser = txtUserName.Text
MsgBox ("Now you are Logged in")
'here put the form you want to open like form1.visible=true
MsgBox "Invalid Password, try again!", , "Login"
Private Sub Command1_Click()
flogin.Visible = True
Private Sub Command2_Click()
' have to check out the code and correct errors if any. have not tested the code