473,405 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Module use?

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 2241
NeoPa
32,556 Expert Mod 16PB
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
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 =...
8
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...
5
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
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...
10
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...
21
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...
40
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: ...
4
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: ...
0
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...
6
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.