Solved

Calling a module in a form.

Posted on 1998-09-09
2
163 Views
Last Modified: 2010-04-30
How do you get a module to run in a form. Here is the code that I have in a module "If (KeyAscii = 13) Then SendKeys "{TAB}"".  I don't want to type it everytime and want to call it from a procedure.
0
Comment
Question by:matthewkwp
  • 2
2 Comments
 
LVL 4

Accepted Solution

by:
mcix earned 50 total points
Comment Utility
In the module define a function or sub-routine to do what you want to do...

Like this:

Public Sub WhichKeyWasPressed(KeyAscii As Integer)
    If KeyAscii = 13 Then
        SendKeys"{TAB}"
    End If
End Sub


0
 
LVL 4

Expert Comment

by:mcix
Comment Utility
You could also set KeyPreview to True on the Form and insert the following code:

Private Sub Form_KeyPress(KeyAscii As Integer)
    Select Case KeyAscii
        Case 13
            SendKeys "{Tab}"
            KeyAscii = 0
    End Select
End Sub
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now