Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Login System In Database


Hello, I was hoping someone will be able to help me with this error I'm getting. The error is 2185 and its asking me to setfocus on the textbox I'm writing the code to work with. But the setfocus command doesn't seem to work.

I also need to create user accounts in access for a register system which record users' date and time of log in automatically when they sign in.. I'm notive with coding so I will appreciate any help that anyone can give me.. Thank you!




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Access Table In Database(Login System)
Yello. I'm making a software for a friend. But inorder to start using the software, a user must be registered.

The problem which i'm having so far is getting the username and password from database.

I need some help with this.

Login System Help
ok lol i got my text file filled with data
username,pass
im trying to make a simple login so i create an account it enters
username,pass into the file.txt

but when i try to login it says my message


visual basic code:--------------------------------------------------------------------------------
Private Sub Command2_Click()
Dim ff As String
ff = FreeFile()
Dim mystring As String
Dim data() As String
Open "C:/file.txt" For Binary As ff
mystring = Space(LOF(ff))
Get ff, , mystring
data = Split(mystring, ",")
If Text1.Text = data(0) And Text2.Text = data(1) Then
MsgBox ("logged in")
Else
MsgBox ("Wrong username or password")
End If
Close ff
End Sub
--------------------------------------------------------------------------------

data(0) = username and data(1) = pass i tested by printing em : but it still don't work

Login System Help
I am trying to create a program that has a login system that works like this if possible....

In the VB Program the login section has 2 form fields, a Username and Password then a connect button. When you click connect to login and continue onto the next section it checks the username and password on my phpbb forums databse which is a mysql database on my website.
I read some sites that sounds like it might work but it mentions databse ip which I dont know, its on a Yahoo! Geocities Web site services.

Login System
I am looking to create a simple login system that protects certain pages

eg. there are 2 users of the system, i want them to only view 1 sheet, the sheet which holds data about them. So when they click the link taking them to their sheet they have to enter a password first.

This might make it simpler

User
|
enter password
|
access to their data sheet


Ive looked in the help files for some information on this, all i have found is:

Set user = object.CreateUser (name, pid, password)

thanks in advance

Login System
does ne one have even a basic system in which users can make thier own account and password which will be saved in a text or access file im not looking for any thing fancy at all just a basic individual account system

ta

Vb Login System
Hi i'm new to this forum and wondered if any of you could help me with the login system i'm making as part of my coursework.

So far it writes the user info into a text file, but i am having trouble checking the username and password against those stored in the file. this is what i have so far...

User Creation:

Code:
If TXTemail.Text = "" Or TXTusername.Text = "" Or TXTsurname.Text = "" Or TXTfirstname.Text = "" Or TXTpass.Text = "" Or TXTpass.Text <> TXTpass2.Text Then
Else

n = n + 1
Users(n).FirstName = TXTfirstname.Text
Users(n).Surname = TXTsurname.Text
Users(n).UserName = TXTusername.Text
Users(n).Password = TXTpass.Text
Users(n).Email = TXTemail.Text


Open "UserInfo.text" For Append As #1
Write #1, Users(n).FirstName, Users(n).Surname, Users(n).UserName, Users(n).Password, Users(n).Email
Close #1

NumberOfRecords = NumberOfRecords + 1

Open "NumberOfRecords.text" For Output As #1
Write #1, NumberOfRecords
Close #1

Login.Show
NewUser.Hide
End If


User Login:

Code:
Open "UserInfo.text" For Input As #1
n = 1
Do While (Not EOF(1))
Input #1, Users(n).UserName, Users(n).Password
If TXTusername.Text = Users(n).UserName Then
If TXTpass.Text = Users(n).Password Then
Form1.Show
Login.Hide
Close #1

End If

End If
n = n + 1
Loop
Close #1

Login System Help
Hello, i've been clicked around on your forum and found incredible works from people allover the world, incredible.. I hope you can help me with my project..

I have created a just a simple "Create" form, that creates .txt files into the right folder where i want it, then my question is.. how can i make a login form for it?

And my second question, How can i get it to get "public" so people can
connect to the same server, is it Winsock i'll be using or Mysql??
I just want a simple login system to my program.
So the easiest way will be the best in this case.
Hope you can give me a answer, thanks..
here's the code i use.
------------------------------------------------
Private Sub Command1_Click()
If Len(Dir$(App.Path & Text1.Text & ".txt")) = False Then


Open App.Path & Text1.Text & ".txt" For Output As #1


Print #1, Text1.Text
Print #1, Text2.Text
Print #1, Text3.Text
Print #1, Text4.Text
Close #1



Let Text1.Text = ""
Let Text2.Text = ""
Let Text3.Text = ""
Let Text3.Text = ""
Call MsgBox("text " & Text1.Text & " text ")

Else

Call MsgBox("text " & Text1.Text & " text ")



Call MsgBox(" text , " & Text3.Text & " text")
Exit Sub

End If

End Sub
------------------------------------------------------

Login System
I have made a login system that calls to my server for confirmation.
At load up, it prompts the user for Username and Password as shown in the picture.


On my host I have it set up as such -
Username input calls to www.yoursite.com/acc/namehere/Username.txt
Password input calls to www.yoursite.com/acc/namehere/Password.txt

I would like to know if it is possible to load a Excel document to my host so that I do not have to continue to make seperate folders for seperate accounts. I want everything to be on one form, and I want the login function to call to it.

Login System
Hi,

I now have a simple VB app which code looks like:


PHP Code:




Private Sub Command1_Click()
If Text1.Text = "MyUser" And Text2.Text = "MyPass" Then
Form2.Visible = True
Form1.Visible = False
Else: MsgBox "Wrong Username/Password", vbCritical, "Error!"
End If
End Sub

Private Sub Form_Load()

End Sub







Its 2 textfields, username(Text1.Text) and password(Text2.Text)
And a login button.

When the login button is clicked, it checks whether the username+password are correct. If not, it says wrong username/pass.

But I want to give this to several users, and want to change their passwords at any time.

So for this I thought opening a winsock connection to 2 textfiles, check if the file contains the username/pass, if it does.. then allow them in. If not, give some error.

Can this be done with VB Winsock?
All I need is some kind of simple login system like this, some sample would be great. Thanks in advance, greatly apprecciated.

~UrlGuy

Making A Login System
How?

I made a program that I am going to be selling, but to stop people from giving it out etc I want to make them need to login.

When they purchase the product I will make them a username and password so they can log on to the program.

The big problem - I dont have a clue how to do it.

Please help

Queries On Login System
hi anyone can tell me how do i write a script to read ms access through mysql language like.

select password from wholetable where username=txtUsername

how do i put this 1 inside the vb code when im using DAO and i hav mounted the history.mdb inside my modules script?

anyone please give me a guide

User Login System?
I know the long way of making a userlogin system:

Command1_click
If text1.text = username
Text2.text = password then
form1.hide form2.show and i would have to add a new user manually then update the program.. is there a way i could store usernames and password where, when a new user is added i dont have to recirculate the program?
anyone have ANY clue what im tlaking about?
if so pls help

Problem With My Login System
I have a problem and i need some big help. I have this as my code:

Private Sub cmdOK_Click()
   If txtPassword = "pass" Then
        LoginSucceeded = True
        Me.Hide
        Else
    MsgBox "You have been Shiftified"
        Unload Me
        frmSeizure.Show vbModal
        txtPassword.SetFocus
    End If
    
    If LoginSucceeded = True Then
Form.Show
End If

And this is my problem, i need to add a message box to this and make it able to retry with the password before it goes into the seizure form. More or less i want it to where if you fail to provide the right password it will pop up a message box and warn you and let you retry. BUt if you get it wrong the second time its will pop up another message box then go directly into the form after the message box.

Newbie- Login System
Hi,

Is there any good reference / source codes where i can actually get information on the following problem,

I need to create a login system (username, password) that actually reads from a text file (separated by comma) to compare the one from the textbox (entered by user). If it is a valid username and password, then proceed to the next form. This is relatively easy using a database access method, however i have to deal with files this time around. Any help please.

Thanks a lot.

System Login User
Dear All,

I want to verify in my vb program, whether the windows login user login to the vb application. That is , if someone login to the windows using his username , only that person should login to the VB application as well.

Can u tell me the way i should read the system variables when i logging to the VB application.

Dulika.

How To Get System Login Time Using VB
i want to create a VB application that will record the system time each time a new user logins to the system.

VB6 Login System Urgent Help Needed!
Hi, i am relatively new to visual basic but know some basic concepts.
my current project involves the use of lots of user names passwords and other details on the people involved, i don't know how to make a script that allows the details to be added to a document of some kind (registration) then uploaded to our site or something (Ideally a file that cant be read by the user, for other users sake) and referred to later for logins, also one that is updated to keep up with new users by using a built in update system.

I hope you understand what im getting at and that someone can offer me help in a basic manor that a noob can understand.

Ill answer any questions and explain anything i have missed

Any help at all accepted

Login && Logout Informationfrom The System
hi ,

     i am(new Vbcity baby) doing the application in Vb.
i want to get login information of the users,
1.I want to get login name of the user and when does he logged in the System (Time) and same for Log-Off


Its urgent

Shrini





 

Help Whit A Login System To My Webbrowser
hey.. all great vbcity ppl
i have a littel prob. i have made a xhtml app. and want a login..

i want 2 tekst box, 1 to the username, and 1 to the password. and when i click it will send this line if i have writen kasper ind the username box and 123456 in the passwordbox

auth.send "gebruikersnaam=kasper&wachtwoord=123456&login=Login"
-----------------------------------------------------------------------------------
Private Sub Command1_Click()
auth.open "POST", "http://mafia-family.nl/index.php?main=login"

auth.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

auth.send "gebruikersnaam=USERNAME&wachtwoord=PASSWORD&login=Login"

file = auth.responseText

If InStr(file, "logged in") Then
Text1.Text = Text1.Text & "Logged In" & vbNewLine
Text1.SelStart = Len(Text1.Text)
Else
Text1.Text = Text1.Text & "Failed To Login" & vbNewLine
Text1.SelStart = Len(Text1.Text)
End If
End Sub
------------------------------------------------------------------------------------

CREATING A LOGIN SYSTEM FOR A HELPDESK PROGRAM
I am creating a Helpdesk system in Access and I would like to create a simple login system. I would have a login table with the Fields "USER ID", "PASSWORD", "ACCESS LEVEL" and "STAFF ID". When someone enters the database I would like a form to pop up which would request the user to enter their ID and password. What I need the login system to be able to do is:

1)Check that the user ID and password match from the login table
2)Direct the user to a form dependent upon their access level (there will be a form for helpdesk users and a unique one for the helpdesk manager ie. 2 acess levels)
3)Store the user ID the user logged in with in a temporary table (known as a control table in Delphi) whilst they are logged in such that for example an object on the form could display the logged in user's name (a staff ID in the login table allows a relationship between it and a STAFF table to be made).

I'm sure that this would require VBA programming of some sort but am a novice when it comes to VBA!

Problem If UserId Does Not Exist When Login To The System.
Hi,
I have login form with txtUserId, txtPwd and txtDept. I can successfully login to the system with UserId and Password whereby the Dept will automatically displayed on the form. But i'm having problem when the UserId entered is incorrect. It gives me an error,

This is what i've done,

Code:
Private Sub Form_Load()
  ...
  ...
  Set Adologin = New Recordset
  
  Adologin.Open "select user_id,password, dept from
         tbluserlogin", db, adOpenStatic, adLockOptimistic
 
  ...
End Sub

Private Sub cmdOK_Click(Index As Integer)
    Adologin.MoveFirst
        
    Do Until Adologin.EOF
        usercode = Adologin.Fields("user_id").Value
        If usercode = txtUserid.Text Then
            Exit Do
        Else
            Adologin.MoveNext
        End If
    Loop
    
    If Not Adologin.EOF Then
        Pass = Adologin.Fields("password").Value
        If Pass = txtPassword.Text Then
                frmMenu.Show
                Unload Me
        Else
            MsgBox "Password is incorrect!", , "Warning!!"
            txtPassword.SetFocus
            Exit Sub
        End If
    Else
        MsgBox "User ID was not found.", , "Warning!"
        txtUserid.SetFocus
    End If
End Sub

Private Sub txtpassword_GotFocus()
    ......
    Set Ado = New Recordset
    
    Ado.Open "select dept from tbluserlogin Where user_id
             ='" & txtUserid.Text & "'", db, adOpenStatic,
             adLockOptimistic
    txtDept.Text = Ado.Fields("dept").Value
End Sub


what i need is to display the relevant department when the user inputs his/her userID.

it works if i enter correct user id (either with correct pwd or wrong pwd), but if the user id is incorrect, this error comes out,

Run-time Error '3021':
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

when i click on Debug button, it goes to this line,

txtDept.Text = Ado.Fields("dept").Value

any idea?
thanx in advance..;)

Database Login
I've just been messing about with a really good bit of source code I found.

It uses the Data object to open an Access file (.mdb) and reads the info (Username & Password) into 2 hidden Labels, then checks them with what you entered, blah blah.

Just looking at the Datas Properties though, and as it's Connect property you can set it to Text (Data1.Connect = "Text;").

I just wondered if this simply means you can make it access a .txt file?

If so, how is the information formatted within the .txt file?

Login To Database
Hi,

my project consists of a serverapp project and a clientapp project. My serverapp consists of all the access to my database and the clientapp is the interface for the client side.

Currently, I would like to implement a log in module for my users. Can someone show me through a code sample how to do it? And how do I add new users to the database?

Thanks.

fAntAsy

Database Login
Can you please look at this code and see why it wont work, basically i am making a database login. this is all linked to the database and can make it scroll through the fields and update the txtboxes, however when i input the correct information into the txtboxes it still loops to my error


Quote:




Private Sub cmd_login_Click()
Dim usrname As String
Dim psword As String
Dim usernam As String
Dim pssword As String
Dim Msg As String


login_data.Refresh
usrname = txtuser.Text
psword = txtpass.Text


Do Until login_data.Recordset.EOF
If login_data.Recordset.Fields("username").Value = txtuser And login_data.Recordset.Fields("password").Value = txtpass Then
login.Hide
projmaint.Show
Exit Sub

Else
login_data.Recordset.MoveNext
End If

Loop

Msg = MsgBox("Invalid password, try again!", vbOKCancel)
If (Msg = 1) Then
login.Show
txtuser = ""
txtpass = ""

Else
End
End If

End Sub

Login To Database
Hello,

I'm trying to access a MS Access XP database from VB6 with ADO2.8. How do I specify the username and password I want to use for the connection? Are there any other things I must do to ensure my application will work for any user under WinXP? Thanks.

Database Login
I am creating a login routine that will check the username and password in table. I have managed to get it to work. The problem is i have used the .Find method to find the Username, if the username exists in the database and the password is the same in the record it will login, however, if the username is incorrect then and error message is generated (See below). Is there a more efficient way to create a login routine for this database via VB? Otherwise, how would i check to see if the username is actually in the database?

Error


Quote:





Run-time error '3021':

Either BOF or EOF is true, or the current record has been deleted. Requested operation requires a current record.







Code:
Private Sub Command1_Click()
With adoRecordSet
If .EOF Or .BOF Then
.MoveFirst
.MoveNext
Else
' What if the Username is incorrect?
.Find "Username = '" & Text1.Text & "'", , adSearchForward
If Text2.Text = .Fields("Password") Then
strUsername = Text1.Text
Form2.Show
Unload Me
Else
MsgBox "The Username and / or Password is incorrect. Please" & vbCrLf _
& "try again.", vbExclamation, "Login Error"
End If
End If
End With
End Sub


Regards,



Jenova

How To Use A Database To Login
In my program, i want to have a database that contains different users. Each user has 3 things they need to know in order to log in. Im using an acces 7.0 database. When the user presses the log in button, i want the database to be searched for a matching user name, then a matching world number, and finnaly a matching password. How would I do this?

Login Screen Using A Mdb Database
Hello,

i've got a question, i'm trying to make a login screen wich uses a access database.
i'm not so good at it yet, i'm a student you know.

can anybody help me?

thx

greetz

Database Application Login?
Hi! Can someone direct me to a site or a link or give me a starting point on a decent way to create a login system for a SQL database front end application. Or how to program the Windows2000 login to verify access levels?

Any help would be great as I'm trying to research this...

Thanks
Aaj

Login Link To Database
How do i link a access database to a login dialog so that when you put in a User Name and password it serches the database.

Anyone Used IBM DB2? Want To Setup Database/login
Hi, im using IBM DB2 for college. I am trying to set it up on my home computer which is running Windows XP Home Edition.

I have installed the program but I can't work out how to setup a database to use. I've done it at college using NetTerm but i don't have that on my home computer, so there must be another way of setting up a data base.

thANKS,

Login W/ MySQL Database
I'm fairly new to Visual Basic and all it's brothers and sisters and I'm trying to figure out the best way to accomplish this task.

I have a website which users can register or what not. The users information is then stored in a MySQL database.

I wonder whats the best way/how would I go about on a form, logging the person if the username/password is correct. I know there is probably multiple ways to do this, but what is the best way?

Thanks in advance!
Cheers, justin

Login With Database Validation
Hi all, how do I make a login screen which validates the username with a database, preferably with a MS Access database.

thanks


dimava

Login To Database Question
I am using the code below to check user names and passwords when logging into my app...I have a field called "Status" which i assign to users depending on there job...

Status = "ADMIN" etc...I am trying to add aline into my code that will check the status and depending on the status enable or disable command buttons on my MDIMainForm.

Private Sub cmdLogin_Click()
SetCNPassword
SetRSPassword "Select * from tblPasswords where UserName = '" & txtUserName.Text & "'" & "And Password = '" & txtPassword.Text & "'"
If rs.BOF = True And rs.EOF = True Then
    MsgBox ("User Name or Password is Incorrect..Please Try Again."), vbCritical, "Onyx Azusa Facility"
        txtPassword.SetFocus
        txtPassword.SelStart = 0
        txtPassword.SelLength = Len(txtPassword.Text)
ElseIf Not rs.EOF = True And Not rs.BOF = True Then
    rs.MoveFirst
    If rs.Fields("UserName").Value = txtUserName.Text And rs.Fields("PassWord").Value = txtPassword.Text Then
    frmLogin.Hide
        MDIMain.Show
End If
End If

End Sub

I have tryed inserting a line with  
if rs.fileds("status").Value = "ADMIN" then
   MDIMain.cmdAdd.Enabled = False
end if

i get no errors but it wont open my main form...once i take out that line it works like normal..


any help would be appreciated

Thanks


dvannoy@onyxes.com


Login Using MS Access As Its Database
In VB.net 2005, I create two textboxes and one Login button. First textbox is Username and another is Password. I link these two boxes to MS Access by using ADO. I match Username to Username field and Password to Password field in Access file. Let say i have many records in my Database. How do i write the code to match these two textboxes to let my user to login to my sistem? Thank you for your code and explanation.

Validate Login Database
hi!,

when i login there is a error message that comes up. This is on the login form. Can u plz look at attached file and let me know any changes. Username is: Rajiv Password is: jain

Create Login W/out Using Database?
Just a simple question from a newbie...

How can you create a login form for your application w/out using a database? I don't know how to use (or what's the use) of the Registry. What are the advantages of programming the Registry anyway?

As to the login, the user should be able to change his/her username and password anytime. What's the best way to do this?

I really need help on this.

Thanks a lot!!!

Creating A Login Database
Ok...I'm working on a 2d MMORPG(Massively Multiplayer Online Role Playing Game) I implemented the multiuser chat with no problem, but now the time has come to implement the login database...I have never worked with database programming before and would just like someone to give me a little bit of sample code and to point me in the right direction of where to read up on it, etc.

I just need to create a database with two fields - Username and Password. When the user connects he types in his username and password, it checks it against the database and if its correct info it lets him in. If not it asks him to try again with different info.

Thanks.

How To Make A Login For An Acces Database?
I want to make an application that has a login form that compares the typed password and username from the textfields with the password and username in an acces database.

Does anyone have any ideas how to make this ?

Thanx in advance

Access Database Login Routine
Can anybody help?

I have created a number of Access databases in 2000 format for the department I work in to log tasks and various other things. However, I want to have a central login page where users will have to enter a username and password to have access to these databases. But I want each user to have a "Security Level" associated with them which, depending on the level of security, will give them access to each database that matches the level of security e.g. Database 1 requires a security level of 3 or higher, Database 2 requires a security level of 2 or higher etc, etc. What I need help with is the easiest and most secure means of doing this. Some people have mentioned about having the passwords encrypted before they're stored, but I'm not sure how to do this.

If someone has got a demo database that they could send onto me that would be great.

V2005, LogIn Form With SQL Database
Hello all.
I'm new to this forum, so please bare with me.

I'm trying to create a LogIn form that checks what the user has inputted against what is stored in the Database.
I have two tables in the Database, users and passwords (Am I even doing that right?).

However, I'm having a massive amount of trouble getting the program to check against the Database.
I've been looking for hours at various tutorials and what not but none of them have advanced me any further.

If anyone could advise me (not sure how long it would take since I'm still learning), or point me in a direction that would help me a lot, I'd appreicate it.

Thanks in advance.

Backup Database To Network Using SA Login
I need to backup my database to the network. The problem is that I will be doing this while logged in as SA. Is there anyway to get SQLServer to use an actual NT login to attach to the network drive.

Currently I get an Access Denied error from the OS. I am assuming that this is because SQL is trying to use SA on my domain and that user doesn't exist in the domain


Thanks in advance

Connecting To A Database Using NT Login Authentication
Hi,

I need that my app connects to a SQL Database using a different NT Login that the one is logged on currently on my PC, how do I define that I want to connect using a different NT login?

Can I achieve this by using a special parameter in the StringConnection property

Thanks in advance

I CAN'T LOGIN TO THE SQL SERVER 2000 DATABASE....
I JUST CREATE A NEW DATABASE IN MY SQL SERVER 2000, I CREATE A USER WHIT ALL THE PERMITS (IN THE SQL ENTERPRISE MANAGER) AND THE NEW USER HAVE A FULL CONTROL FOR THE DATABASE BUT WHEN I TRY TO CONECT IN VB6 I GOT THE ERROR:

Login Failed for User 'NewUser'. Reaseon: Not associated with a trusted SQL Server Conection.

What I need to do?? I miss somthing??

Thans for your help...

Creating A Database-driven Login With Vb6
Hi

i just started using vb6 a month ago and i need to design a database-driven login page, the code i have works but when i try to put in a usename and password nothing happens, can someone tell me what i did wrong and what i need to do.

Option Explicit

'THIS IS THE CONNECTION OBJECT
'PUBLIC SO THAT THE OTHER FORMS CAN ACCESS
Public conn As New ADODB.Connection

'THIS IS THE RECORD SET OBJECT
'PUBLIC SO THAT THE FORMS CAN ACCESS
Public recset As New ADODB.RecordSet

'THIS IS THE FIELD OBJECT
'PUBLIC SO THAT THE FORMS CAN ACCESS
Public fld As ADODB.Field

'WE WILL USE THIS FOR QUERIES
'PUBLIC SO THAT THE OTHER CAN ACCESS
Public sqlstr As String

'THIS SUB PROCEDURE IS TO INITIALIZE THE RECORD SET
'WE WILL CALL THIS WHEREVER WE NEED THE INITIALIZATION FOR
'OUR RECORD SET
Public Sub InitRecSet(rs As ADODB.RecordSet, cn As ADODB.Connection)
        With rs
            .ActiveConnection = cn
            .CursorType = adOpenKeyset
            .LockType = adLockOptimistic
        End With
End Sub

'THIS SUB PROCEDURE IS TO INITIALIZE THE DATABASE CONNECTION
'WE WILL CALL THIS IN FORM LOAD
Public Sub InitConnection(cn As ADODB.Connection)
    With cn
        .ConnectionTimeout = 30
        .CommandTimeout = 30
        .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                             "Persist Security Info = False;" & _
                             "Data Source = " & "C:/cs450.mdb"
        .Open
    End With
    
    
    
End Sub



Dim username As String
        Dim password As String
        password = txtpass.Text
        username = txtuser.Text
        
        

End Sub

i am not sure it is complete please help someone, i need it immediately

thanks

Login Using MS Access Database For Verification
Right, Hello!

Some people know me already, some dont - but if either can help, youre all great

basically my application needs multiple users.

an Administrator who can do just about anything
other Staff who can use the app
guest user who can use it with limited and/or varying functions


All i want is for any given user to log on with a username and password, then i want my application to check with a database (ms access) to verify the input info.

The only snag is it will only compare the input with the first record in my database (using the ADODC datacontrol and datagrid control)

the code i have used is as follows (The two fields in my database are UserID and Password):


Private Sub cmdOK_Click()

    If txtPass.Text = frmPass.Adodc1.Recordset.Fields("Password") And txtUser.Text = frmPass.Adodc1.Recordset.Fields("UserID") Then
        frmSwitchboard.Visible = True
    Else
        MsgBox "Login Failed. Please check your UserID and Password."
    End If
End Sub

(frmSwitchboard is what becomes availiable if the userID and password mathc records. frmPass is my Login form.)

So, basically how do i modify that code so it will search all records within the database, instead of just the first one!

as usual any and all help is appreciated!

Acheron



Liberate Te Ex Inferis. Liberate Te Ex Me.

Login Script Useing A DataBase
Ok I fought with this for a log time and finally got it. I came in here for the help I needed to get me on the right track. Now I have it runnign perfectly so I'll share the end result with everybody so that anyone else who has bee fighting with this can get through it with alot more ease then I did.

1. Create the database. For thoughs of you who have never used a database before you probally have no idea how to do this. So I'll walk you through it.

a. Goto the Add-Ins menu and select Visual Data Manager. this will load the visual data manager which in turn you can use to create your data base
b. Make sure that the Table type Recordset and Use Data Control on new Form buttons are selected on the tool bar.
c. Goto the File menu select New then select Microsoft Access and finally select the latest version of the data base.
d.Now name the database and save it to the location you want it to be accessed from.
e. Right click Properties and select New Table
f. Name the Table. I'll use the name UserProfile for reference sake.
g. Click add feild
h. Name the feild.I'll use the name Users for reference sake.
i. Click Add Feild
j. Add the information that you need to access durin your login sequeince and there data types. UserName and UserPass for the most basic of login scripts.
k. Close the Add Feild form.
l. Click the Build the Table button.
m. Right click Users and select open.
n Add a few users to your data base. Besure to clickUpdate and Add after each one.
o. Close the Table.
p. Select the File[/B menu and select Close
q. Now close the Visual Data Manager[/B]

Congradulations you have just created your first data base.

Now that you have the data base you'll need to add a couple of controls to your login form.

2. Start by deleting the Username Textbox and replacing it with a DBCombo Name this DBCombo DBName.

3. Add a Data Control Set the properties as follows:
Visible=False
DataBaseName=the location of your newly made DataBase
RecordSource=Users or whatever you named the feild you placed your userlist in.

4. Add a DBGrid Set the properties as follows:
Visible=False
DataSource=Data1Or whatever you named your Data Control

5. Now add this code to your OK button

Code:

Private Sub cmdOK_Click()
'Sets Variables for Password script using
'Data Base
Dim List As Integer
Dim i As Integer
Dim Record As Integer
Dim UserName As String
Dim UserNeed As String
Dim UserPass As String
'Initalizes Record so that if no record
'so the value can be checked later to
'check if the UserName was found
Record = -1
'Sets userneed to the inputted name
UserNeed = DBName.Text
'deturmains how many users are in the
'data base
List = DBGrid1.VisibleRows
'Goes through the data base one record at
'a time looking for the UserNeed
For i = 1 To List
UserName = DBGrid1.Columns(0).CellText(DBGrid1.RowBookmark(i - 1))
'If the User Need is found it sets
'record to the records index
If UserName = UserNeed Then
Record = i - 1
End If
Next i
'Displayes message if record exits the sub
' and ereases the inputed text
' if the record is not found
If Record = -1 Then
MsgBox "Sorry That User name Does Not Exsits"
DBName.Text = ""
Exit Sub
End If
'Pulls the password off of the data base
UserPass = DBGrid1.Columns(1).CellText(DBGrid1.RowBookmark(Record))
'Check for the corect Password
If TxtPassword.Text = UserPass Then
Loads the program if
'the correct pasword is entered
FrmMain.Show
Unload frmLogin
'displayes a message and earases the
'inputted password if pasword is
'input incorrectly
Else: MsgBox "Incorect Password Please Try Again"
TxtPassword.Text = ""
End If
End Sub


That completes your login Script I hope that you will find as much use for this as I already have.

Change Login Password And Update In Database
What I'm trying to do is get a new password from the user and overwrite the old password in the database. This new password will be retrieved from a Text box. I've been trying to use SQL statements to update it for me but it didn't work. Help me please! It's very urgent for my project i gotta present on 3rd March. Please! Anybody!

Creating A Login Form That Checks Against The Database
Hello and HELP!

I am a near or a complete newbie to vb 6.0 or any versions. ok..I'm assigned to create a login form with two textbox - username and password. Plus two command buttons, to enter or reset.

So..how do i connect my form to my access database so that it would check against the database for the correct username and password before allowing the user to login? I have search through the posts in the forum and on the web for days but failed to find any or failed to understand it. Sorry for this newbish question because i am new..

Thanks.

Copyright 2005-08 www.BigResource.com, All rights reserved