Forum Discussion
JustAndy
Feb 03, 2025Copper Contributor
TRYING TO BUILD A LOGIN BUTTON/PASSWORD
Hi there, I hope you will be able to help me. I am very new to access and managed to build a small database for my work, mainly from watching you tube videos and reading google information however, I want to start upping the anti a little more by adding a level of security so users need to input a user name and password to gain access to the database. My first stumbling block is the 'build event'. Whenever I right click on my login button, it takes me to the macro screen yet when I watch videos online, you get the option to select code builder, I cannot for the life of me see how to change this, any advise please would be greatly received.
Many thanks,
Andy
Hi,
If you "automatically" get such an embedded macro every time you create a button, then the control wizard is activated, which for many years has only created macros instead of VBA. To deactivate it:
Open a form in design view and in the ribbon go to the Form Design tab, in the Controls group, click the little down button to the right of the group and deselect Use Control Wizards .
From then on when you choose Build Event in the control shortcut menu or when you click on the elipsis on an event property line in the property window a little dialog window will open that let's you choose to build a macro, VBA code or an expression. Gerrit already described how to get rid of this dialog and always land in the VBA editor.
Servus
Karl
****************
Access Forever News DevCon
Access-Entwickler-Konferenz AEK- JustAndyCopper Contributor
Hi there, brilliant thank you for this I think I have cracked it now. As mentioned I am trying to build a simple code
to be able to make my form a user log in form. I have tried watching some videos to create the code but keep getting errors. I have the following setup;
Table called: UserTable with fields UserID , Username , Password
Form called: LoginForm with username, password boxes and two buttons, logon and cancel
***************************
Is this going to be something too complex for me to do myself as a newbe to access?
Thanks again,
Andy
- Gerrit_ViehmannBrass Contributor
File -> Options-> Object designers -> Always use event procedures (set checkbox)
This setting will not alter wizard behavior.
Remove existing event macros by deleting the "[Event Procedure]" text (or similar) in the event property. This will not delete VBA code (only the binding to it) or macro objects, but it will delete ad-hoc macros. Press F4 to show the properties window in form design mode and look in the events tab.
- JustAndyCopper Contributor
Hi there, brilliant thank you for this I think I have cracked it now. As mentioned I am trying to build a simple code to be able to make my form a user log in form. I have tried watching some videos to create the code but keep getting errors. I have the following setup;
Table called: UserTable with fields UserID , Username , Password
Form called: LoginForm with username, password boxes and two buttons, logon and cancel
***************************
Is this going to be something too complex for me to do myself as a newbe to access?
Thanks again,
Andy
- Gerrit_ViehmannBrass Contributor
Dear Andy,
It might indeed be a bit complex due to the nuances involved in implementing secure login mechanisms:
- Storing passwords securely and handling authentication requires a good understanding of security practices to prevent vulnerabilities. Access will provide very little help here. For example, Access doesn't natively support 2FA.
- Data stored in Access DBs can be somewhat secured, but if more than superficial tamper proofing is needed, put the data in a SQL Server (or PostgreSQL, etc.) database on a well-configured server. Also, make backups.
- If at all possible, don't require an additional login of your users. The user experience is not great. Learn about Role-Based Access Control (RBAC) and Active Directory security groups.
- Dealing with errors can be tricky, especially if you're not familiar with debugging techniques. Learn about the Access VBA IDE and how to create error handlers.
You can absolutely accomplish this with some patience and persistence.
Good luck!