Return to Website

MS Access

Computers at Large brings MS Access Forum for you to ask questions, answer questions or look up solutions

MS Access
Start a New Topic 
Author
Comment
View Entire Thread
Re: Login & Report Generation

I would do this: create a table with Usernames and Passwords (it does not have to be really long). Then I would have a login in form. It could be as simple as an Unbound Form. You would just have two text boxes for the user to enter the username and password. A command button, that opens the UserName Table and looks through it to find the Username and Password (if it is there it would open a new form, if not it would open a form that tells the user it is a bad password.) This input form does not need scroll bars, navigation buttons, just a plan form. Doing it the way you have your code, is that the usernames and passwords have to be embedded in the actual code.




If you refer to the username that was entered it would look like: Forms!frmLogin!txtUserName....if you keep that login form open, you can refer to the Username over and over again for your reports, querys, etc.




Report - Create your report, base it on a query, in the query for the criteria have it as Forms!frmLogin!txtUserName (for that user, or change it for another field.) Then the report will only use that Username or whatever else you want to pick.




Put a command button on the form with the Docmd.OpenReport "MyReportName", Preview line of code for the on_click event....and then you are set to go!