[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Calling a module in a form.

Posted on 1998-09-09
2
Medium Priority
?
250 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 Comments
 
LVL 5

Accepted Solution

by:
yronnen earned 200 total points
ID: 1433863
in the module write
public sub ButtonClick(KeyAscii)
If (KeyAscii = 13) Then SendKeys "{TAB}"
end sub

in your keydown event on every form write
ButtonClick(KeyAscii)


0
 
LVL 1

Expert Comment

by:bharris1
ID: 1433864
First you can always 'copy and paste' code.  This has become one of my favorite helpful tips for coding.

Second, the KeyDown event doesn't give you the Ascii code for the key pressed it's in the KeyPress event.

Third, you should be able to call it like anything else.

IN FORM:
Private Sub Text1_KeyPress(KeyAscii As Integer)
    MyProcedure KeyAscii
End Sub

IN MODULE:
Public Sub MyProcedure(KeyAscii As Integer)
    If (KeyAscii = 13) Then SendKeys "{TAB}"
End Sub


0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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

656 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