How do I create a security module in Access? For instance, when someone opens a database, Access prompts them a username and password, if the username is not in the login table (physical table), then give an error. Now, the main idea is, if the user is in the table, proceed with logon. And whatever that user (who logs on) do in the database (like update records, modify records) log his name on that record he/she edited. In other words, I need access to log all the changes made on each record by using the logged on user.
For the rest, search here on audit and you should find some threads.
Thanks for the link, that's kind of helpful. But I do not need to restrict the objects (tables, forms, queries) in the DB, I want to just log the name of the user that modifies any record. For instance, there's a record for a client name John Doe and his phone number changed, so we must update it in the system. I need the system to log the user that made the update and which record(s) and field(s) he/she updated.
So long as you understand that "roll your own" security is nowhere near as secure as Access security. I've done it myself many times in similar situations where I just want to know who's doing what. It's fairly simple. Make a table with user ID and password fields. Create a start up form with textboxes for each. Behind a "login" button, check the values in the textboxes against the table, and open up your "main" form if they're valid. Save the user ID so you can use it in your audit functions.
By the way, if you just want the user, you can grab the name of the person logged into the PC and just use that, rather than having a login at all.
-How do I build audit functions?
-You're talking about the person logged in the PC, right. If so, how do I call his name in a function/code/etc. Please explain to me in details how to do what you just proposed? I'm quite naive on VBA. Thank you for your responses and help.