hi, im new here, ahhm can u help me abt my project, its a library system that have database and u need to login first to borrow a book, first u need to register, after register you will have ur profile, that profile consist of searching and borrowing books, and returning books. When you borrow the book it will enter to your list that u borrowed a book from that u will see also its date when u borrowed it and penalty if u not returned the book in the due date. Also when you clicked the return button it will go to the admin that u will return the book, and the admin will accept it when he/she receive the book so that you will have no more status on your profile. There is also login for the admin, and go to other interface not same as the student. In admin interface, there are ADD BOOK a, DELETE and EDIT book, also there is a window that will see the list of book that borrowed by the student.
In SEARCH and BORROW BOOK WINDOW, there are alphabet A-Z and when you click a letter e.g LETTER A, the combo box will only show the category of the book that starts with letter A.

i need to know, when someone logged by his account his database will be the one that can handle his borrowed books.
e.g
A studentA borrowed a book chemistry then the chemistry book will be on his profile and wait until it return to the library. Then, the librarian will know that someone borrowed the chemistry book.

PS :)
the quantity of the book also update,
e.g
chemistry book = 5pcs
STUDENTA borrow 1 so the available CHEMISTRY BOOK was 4pcs

help me please :)

Tokipot, nobody here will do the entire project for you. this is a helping community where you must at least show some effort from your side. Show us some code and we will gladly help with error resolving etc.

Please read our rules HERE.

nope, im not asking to create a proj, im asking for a help that how i can connect my database when user logged his or her account. example here when i logged my email and pw it shows my account, not your account.

Go to THIS link to get the correct connection code needed for your version of access database.

Then reference microsoft activex data objects 2.8 library (preferably 6.0 back compat library to run all all windows versions)

Use the following code to get a record set from your database. Add code then to compare the login of a user. If ANY of this does not make sense, you will need to read up on the basics.

Dim cnCheck As ADODB.Connection
Set cnCheck = New ADODB.Connection
Dim rsCheck As ADODB.Recordset
Set rsCheck = New ADODB.Recordset

cnCheck.CursorLocation = adUseClient

cnCheck.Open "provider = microsoft.jet.oledb.4.0;persist security info=false;data source = " & App.Path & "\YourDatabaseNameHere.mdb"

rsCheck.Open "SELECT * FROM YourLoginTableNameHere", cnCheck, adOpenDynamic, adLockPessimistic

If rsCheck.BOF = True Or rsCheck.EOF = True Then
    Msgbox "No login detail found."

    Exit Sub    
            Else
    ''Your code here to check if the correct data was returned to log user in...
end if

for this im gonna try this :) i will reply here if i have more question :) tnx sir :)

It is a pleasure. This has answered your question. If you have any new questions, please open a new thread, I'll be helping from there. :)

Please mark this one as solved, at the bottom left here. Click on "Mark This Question as Solved", thanx.

Your code here to check if the correct data was returned to log user in...

i dont get it :)

Edited 4 Years Ago by tokipot

based on link, where i will paste it?

I have used the following part also from the link, so, it is already pasted in here -

cnCheck.CursorLocation = adUseClient

--->>>cnCheck.Open "provider = microsoft.jet.oledb.4.0;persist security info=false;data source = " & App.Path & "\YourDatabaseNameHere.mdb"

rsCheck.Open "SELECT * FROM YourLoginTableNameHere", cnCheck, adOpenDynamic, adLockPessimistic

Your code here to check if the correct data was returned to log user in...

rsCheck.Open "SELECT * FROM YourLoginTableNameHere WHERE username ='" & txtUsername.Text & "'", cnCheck, adOpenDynamic, adLockPessimistic

If rsCheck.BOF = True Or rsCheck.EOF = True Then
    Msgbox "No login detail found."
    Exit Sub    
            Else
    ''Your code here to check if the correct data was returned to log user in...
    If txtUsername.Text = rsCheck!username AND txtPassword.Text = rsCheck!password Then
        msgbox "You are logged in!!"
            Else
        msgbox "Incorrect username or password
    end if
end if

''rsCheck!username and rsCheck!password is the returned value from your table where the fields are named username and password...

after that is any data from the database will also match ??? example: on facebook, it shows my events etc ,,, using my login acct?

Correct, set a global value to the user that logged in and then use it throughout your application. In a module add -

Dim strUserId As String

Now, whenever you need the user id you just call it...

rsCheck.Open "SELECT * FROM YourLoginTableNameHere WHERE userid ='" & strUserId & "'", cnCheck, adOpenDynamic, adLockPessimistic

i see i'll try, last question, how can i use the variable from other form? example the integer A on form1 is needed for form2 ?

If you don't know how to create a module, I suggest you take a tour of vb first and get an understanding of how VB works prior to commencing such an abitious program.

Comments
agree
Agreed!!

Chris said it all, you need to know the basics first before you can attempt coding an application as you currently want. I'm out of this thread for now.

This article has been dead for over six months. Start a new discussion instead.