Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Calling a module in a form.

Posted on 1998-09-09
2
Medium Priority
?
170 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 4

Accepted Solution

by:
mcix earned 100 total points
ID: 1433861
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
ID: 1433862
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

730 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