my problem is so simple guys,

how do i make 3 textboxes connect to a database of users using adodc in a different form?

so that if you entered your userid, username and password you could log in.

i cant post my code now but ill try later on.

First load the saved user name and password from your table -

Dim strUserName As String, strPassword As String

Set rsLogin = New ADODB.Recordset
rsLogin.Open "SELECT Username, Password FROM MyLoginTable",cnLogin, adOpenStatic, adLockOptimistic

strUserName = rsLogin!Username
strPassword = rsLogin!Password

If Not txtUsername.Text = strUsername Then
   msgbox "Ooops, Invalid user name"
   txtUsername.Setfocus
   Exit Sub
Elseif Not txtPassword.Text = strPassword Then
   msgbox "Ooops, Invalid password"
   txtPassword.Setfocus
   Exit Sub
      Else
   msgbox "Cool, user name and password matched
End If

rsLogin.Close

can i ask you something, what is the rsLogin in the program?
is it the table name?

No, the table name will be what ever you name your table in a database. rsLogin refers to the "control" that will control your data in the table you have created, in this case "MyLoginTable". You need to read up on recordsets, tables and fields to get a better understanding of this.

The Login form can be created when you click on 'Project, Add Form'. Select 'Login Dialog Form' from the menu displayed.

umm.im using visual 6,where i can find the built in log in system?

It is there in the fist screen (after splash screen), where you select the project type.

or

go to add forms from there also you can add.

Edited 6 Years Ago by debasisdas: n/a

but there is a runtime error when i play the program and it focuses on the adodb part. so i changed it to adodc1 since im using adodc. but it points out the rsLogin to be the next error. why is that?

All my apologies. If we have read your post properly, we would have seen that you are using a control to manipulate your data, sorry.

Without the control, do the following in your form code window -

'Under a command button, add the following code
Dim cnLogin As ADODB.Connection
Dim rsLogin As ADODB.Recordset

Set cnLogin = New ADODB.connection
cnLogin.CursorLocation = adUseClient

cnLogin.Open "provider = microsoft.jet.oledb.4.0;persist security info=false;data source = C:\MyLoginDatabase.mdb" 'Change "MyLoginDatabase with the your database name. Also see that the path is correct, otherwise use App.Path

Dim strUserName As String, strPassword As String
 
Set rsLogin = New ADODB.Recordset
rsLogin.Open "SELECT Username, Password FROM MyLoginTable",cnLogin, adOpenStatic, adLockOptimistic 'Or whatever your field names are and the table name "MyLoginTable" with your own table name.
 
strUserName = rsLogin!Username
strPassword = rsLogin!Password
 
If Not txtUsername.Text = strUsername Then
   msgbox "Ooops, Invalid user name"
   txtUsername.Setfocus
   Exit Sub
Elseif Not txtPassword.Text = strPassword Then
   msgbox "Ooops, Invalid password"
   txtPassword.Setfocus
   Exit Sub
      Else
   msgbox "Cool, user name and password matched
End If
 
rsLogin.Close
cnLogin.Close

Remember to have MS ActiveX Data Objects 2.8 (or your highest version) selected under references.

thats okay, i would just try to work it out from here
maybe i just dont have enough experience in this stuff.

Alshidhani, I see that you are a new member, welcome to Daniweb.:)

It is however required of you to read our posting rules first. You have "hijacked" another posters question.

Please open your own post and I will gladly assist in finding a solution to your problem.:)

You can find our posting rules HERE.

This question has already been answered. Start a new discussion instead.