473,569 Members | 2,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Module use?

7 New Member
I'm attempting to create a login form to an access database. See code below. Login form has a ListBox (List10) and a text box (Text12). for users and passwords. List box created from KTCEMployees table and KTCEmployee is the index (hidden)


Expand|Select|Wrap|Line Numbers
  1. Private Sub Login_Click()
  2. On Error GoTo Err_Login_Click
  3.  
  4.     Dim stDocName As String
  5.     Dim stLinkCriteria As String
  6.  
  7.     stDocName = "KTC Order Form"
  8.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  9.  
  10. Exit_Login_Click:
  11.     Exit Sub
  12.  
  13. Err_Login_Click:
  14.     MsgBox Err.Description
  15.     Resume Exit_Login_Click
  16.  
  17. End Sub
  18.  
  19. Private Sub List10_AfterUpdate()
  20. 'After selecting user name set focus to password field
  21.     Login.Text12.SetFocus
  22. End Sub
  23.  
  24. Private Sub Login1_Click()
  25. 'Check to see if data is entered into the password box
  26.     If IsNull(Login.Text12) Or Login.Text12 = "" Then
  27.         MsgBox "You Must Enter a password.", vbOKOnly, "Required Data"
  28.         Login.Text12.SetFocus
  29.         Exit Sub
  30.     End If
  31.  
  32. 'Check value of password in KTC Employees table to see if this
  33. ' matches value chosen in list box
  34.  
  35.     If Login.Text12.Value = DLookup("Password", "KTCEmployees", _
  36.                                     "[KTCEmployee]" & Login.List10.Value) Then
  37.         KTCEmployee = Login.List10.Value
  38.  
  39.         'Close login form and open Form menu
  40.  
  41.         DoCmd.Close acForm, "Login", acSaveNo
  42.         DoCmd.OpenForm "FormMenu"
  43.  
  44.     Else
  45.         MsgBox "Password Invalid.  Please try Again", vbOKOnly, "Invalid Entry!"
  46.         Login.Text12.SetFocus
  47.  
  48.     End If
  49.  
  50. End Sub
  51.  
I am supposed to create a module to declare variable such as:
Public KTCEmployee As Long

but I don't know how to do this and do you have to link it to the form?
Oct 30 '06 #1
1 2246
NeoPa
32,564 Recognized Expert Moderator MVP
In Project window of VBA window, go to Modules in your Project and right-click.
Select Insert Module.
If you add the code
Expand|Select|Wrap|Line Numbers
  1. Public KTCEmployee As Long
then it will be visible across your project, including in Queries and Reports.
Oct 30 '06 #2

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

Similar topics

8
3848
by: Bo Peng | last post by:
Dear list, I am writing a Python extension module that needs a way to expose pieces of a big C array to python. Currently, I am using NumPy like the following: PyObject* res = PyArray_FromDimsAndData(1, int*dim, PyArray_DOUBLE, char*buf); Users will get a Numeric Array object and can change its values (and actually change the...
8
3942
by: Irmen de Jong | last post by:
What would be the best way, if any, to obtain the bytecode for a given loaded module? I can get the source: import inspect import os src = inspect.getsource(os) but there is no ispect.getbytecode() ;-)
5
2010
by: dody suria wijaya | last post by:
I found this problem when trying to split a module into two. Here's an example: ============== #Module a (a.py): from b import * class Main: pass ============== ==============
3
16491
by: David T. Ashley | last post by:
Hi, Red Hat Enterprise Linux 4.X. I'm writing command-line PHP scripts for the first time. I get the messages below. What do they mean? Are these operating system library modules, or something in PHP that I don't have? Do I need to install more Linux packages? Or adjust PHP in some way?
10
5476
by: Bonzol | last post by:
vb.net Hey there, could someone just tell me what the differnce is between classes and modules and when each one would be used compared to the other? Any help would be great Thanx in advance
21
34360
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready...
40
3455
by: rjcarr | last post by:
Sorry if this is a completely newbie question ... I was trying to get information about the logging.handlers module, so I imported logging, and tried dir(logging.handlers), but got: AttributeError: 'module' object has no attribute 'handlers' The only experience I have in modules is os and os.path ... if I do the same thing, simply...
4
2168
by: rkmr.em | last post by:
Hi I have a function data, that I need to import from a file data, in the directory data If I do this from python interactive shell (linux fedora core 8) from dir /home/mark it works fine: cwd = data os.chdir(cwd) print os.getcwd()
0
2136
by: Fredrik Lundh | last post by:
Jeff Dyke wrote: so how did that processing use the "mymodulename" name? the calling method has nothing to do with what's considered to be a local variable in the method being called, so that only means that the name is indeed available in the global scope.
6
2254
by: dudeja.rajat | last post by:
Hi, I found on the net that there is something called module initialization. Unfortunately, there is not much information for this. However, small the information I found module initialization can be of use to me in my project. I'm currently messing with a problem where I'm keeping my global variables ( or symbols) in a module and the...
0
7609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7921
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5504
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3651
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.