473,487 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do I use a AccessVBA Code Module to declare a public varible?

1 New Member
What is a code module? I want my log-in to save the username so I can enter it in other forms automatically. I have been told I need to declare a public variable in a "code module". What is that, how do I do it, and is there anything special I need to know about using it?
May 7 '19 #1
2 969
NeoPa
32,556 Recognized Expert Moderator MVP
This is about availability. Code is stored in modules but there are Standard code modules, Object (Form/Report) code modules and Class code modules.

For data to persist and be globally accessible, as I suspect you desire, it's easiest to declare them as Public scope in a Standard code module.

As to the advice to use this technique I find that somewhat suspect. In almost all circumstances the ID you've already used to log in to Windows or your domain should be used to control access to the system. Windows has a better and more reliable way of checking you're a valid user than anything you can do in Access so it's very dangerous to take the Access approach for security. Nowadays it can even lose you your livelihood and expose you to risk personally of being prosecuted for inadequate security.

Use a system that is tried and tested. It even provides Groups for you to use that make control of security very flexible and powerful.
May 7 '19 #2
twinnyfo
3,653 Recognized Expert Moderator Specialist
This may be a bit above your level of experience (based upon your initial questions, I am assuming this), but you may want to take a look at this article on User Permissions within Access. Its security is based upon verified users logging into a secured network area. This DB simply uses that information to redirect users to appropriate menus.

It's a thick read, but could be very helpful in your situation.
May 8 '19 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
4383
by: Justin Koivisto | last post by:
OK, here's one of the rare times where I call out to all of you. ;) I need to implement a promotional discount code module into osCommerce 2.2 Milestone 2. I've never created an OSC module...
6
30541
by: The8thSense | last post by:
how to declare static varible and static method inside a class ? i try "public static ABC as integer = 10" and it said my declaration is invalid Thanks
4
273
by: Ram | last post by:
I have a code module with main as subroutine name. How to launch a Windows form from here. Thanks, Ram
1
1235
by: Thomas Heller | last post by:
I'm using the code module to implement an interactive interpreter console in a GUI application, the interpreter running in a separate thread. To provide clean shutdown of the application, I have...
2
1600
by: Thelma Lubkin | last post by:
I do a lot of my code writing for Access forms at home, where I have no access to Access. While in Access, I export the entire primary code module, xxx.cls where xxx begins "Frm_" and includes...
15
2966
by: esha | last post by:
I need to have a Public variable in my project. In VB it can be declared in a standard module. Where can I do it in C# ? I tried to do it in default class Program.cs and I tried it in an added by...
1
1287
by: dreamer1963 | last post by:
Write a line of code to declare and construct a Date object named curDate.
3
10628
by: Salad | last post by:
I'm asking this for curiosity's sake. Is there a code module size limit? I looked at Access Specifications in help and didn't notice a code limit size. For some odd reason I was under the...
10
2443
by: =?Utf-8?B?R3JlZw==?= | last post by:
I have the following three files. 1. Users.aspx is a webpage that uses the <asp:ObjectDataSourcecontrol to populate a simple <asp:ListBoxcontrol. 2. The UserDetails.cs file creates a Namespace...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7132
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7180
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5439
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4870
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4564
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
600
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.