Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.basic.visual.misc > #442
| From | "Access Developer" <accdevel@gmail.com> |
|---|---|
| Newsgroups | comp.lang.basic.visual.misc |
| Subject | Re: Newbie question about nested subroutines |
| Date | 2011-10-06 16:05 -0500 |
| Message-ID | <9f6jh3FpdsU1@mid.individual.net> (permalink) |
| References | <4e8df7f8$1@dnews.tpgi.com.au> |
Either I don't understand what you want to do, or (and I suspect this is the case) you don't understand programming with VBA. You can either put that Sub Procedure in the general section of the Form's module or in a separate standard Module with a Control object and Label object as arguments, and call it from an event of the textbox, passing the textbox and label. If you put it in a standard module, you can call if from code in multiple Forms' modules. -- Larry Linson, Microsoft Office Access MVP Co-author: "Microsoft Access Small Business Solutions", published by Wiley Access newsgroup support is alive and well in USENET comp.databases.ms-access "Dimmer" <Dimmer@Best.com> wrote in message news:4e8df7f8$1@dnews.tpgi.com.au... > Hi all > > I am trying to arrange to access this sub a number of times in a program. > > The sub works fine in intercepting ESC and certain other keystrokes. > > I want to somehow arrange to repeatedly use it and this instictively > suggests that it should be in a subroutine. But it is already in one! Is > there such a thing as nested subroutines? I want to call it and pass to it > the particular Textboxes and Label concerned. I emphasise that it works > fine but I just don't want to have to have it appearing 13 times in a 13 > field form I have designed. > > Any ideas? > > Private Sub Text8_KeyPress(KeyAscii As Integer) > Label23.Caption = "" '*** this label is used elsewhere for warning > messages against that (8 in this case) text field > If KeyAscii = 27 Then '*** ESC to blank and step back > Text8.Text = "" > Text7.SetFocus > ElseIf KeyAscii <> 8 Then '***overtype > Text8.SelLength = 1 > End If > Call AlibModule.EnterTabKey(KeyAscii) 'this is a standard routine (Alib > is Alan library!) I have developed that treats ENTER and TAB the same. It > works fine > End Sub > > > The above all works fine. It's just that I want to avoid typing it all out > again and again with different values for the LabelNo, TextNo, and > PriorTextNo. >
Back to comp.lang.basic.visual.misc | Previous | Next — Previous in thread | Next in thread | Find similar
Newbie question about nested subroutines "Dimmer" <Dimmer@Best.com> - 2011-10-07 05:48 +1100
Re: Newbie question about nested subroutines "Bob Butler" <bob_butler@cox.invalid> - 2011-10-06 13:54 -0700
Re: Newbie question about nested subroutines "Dimmer" <Dimmer@Best.com> - 2011-10-07 10:39 +1100
Re: Newbie question about nested subroutines "Bob Butler" <bob_butler@cox.invalid> - 2011-10-06 16:54 -0700
Re: Newbie question about nested subroutines "Dimmer" <Dimmer@Best.com> - 2011-10-07 11:34 +1100
Re: Newbie question about nested subroutines "Access Developer" <accdevel@gmail.com> - 2011-10-06 16:05 -0500
Re: Newbie question about nested subroutines "Dimmer" <Dimmer@Best.com> - 2011-10-07 10:41 +1100
Re: Newbie question about nested subroutines "Access Developer" <accdevel@gmail.com> - 2011-10-06 22:49 -0500
Re: Newbie question about nested subroutines "Thorsten Albers" <gudea@gmx.de> - 2011-10-06 23:16 +0000
Re: Newbie question about nested subroutines "Dimmer" <Dimmer@Best.com> - 2011-10-07 11:36 +1100
Re: Newbie question about nested subroutines ralph <nt_consulting64@yahoo.net> - 2011-10-06 23:58 -0500
MZ Tools "Dimmer" <Dimmer@Best.com> - 2011-10-08 19:37 +1100
Re: MZ Tools ralph <nt_consulting64@yahoo.net> - 2011-10-08 10:53 -0500
Re: Newbie question about nested subroutines "Dimmer" <Dimmer@Best.com> - 2011-10-07 12:15 +1100
Re: Newbie question about nested subroutines "Dimmer" <Dimmer@Best.com> - 2011-10-07 12:32 +1100
Re: Newbie question about nested subroutines "Bob Butler" <bob_butler@cox.invalid> - 2011-10-06 19:28 -0700
Re: Newbie question about nested subroutines Deanna Earley <dee.earley@icode.co.uk> - 2011-10-07 09:17 +0100
Re: Newbie question about nested subroutines ralph <nt_consulting64@yahoo.net> - 2011-10-07 10:26 -0500
Re: Newbie question about nested subroutines Deanna Earley <dee.earley@icode.co.uk> - 2011-10-07 17:34 +0100
Re: Newbie question about nested subroutines Deanna Earley <dee.earley@icode.co.uk> - 2011-10-07 17:37 +0100
Re: Newbie question about nested subroutines ralph <nt_consulting64@yahoo.net> - 2011-10-07 12:04 -0500
Re: Newbie question about nested subroutines "Dimmer" <Dimmer@Best.com> - 2011-10-08 05:32 +1100
Re: Newbie question about nested subroutines ralph <nt_consulting64@yahoo.net> - 2011-10-07 14:30 -0500
csiph-web