Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / December 2005

Tip: Looking for answers? Try searching our database.

Many TextBoxes - One Event

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
marwan - 08 Dec 2005 17:26 GMT
I have many TextBoxes in my form (about 14 TextBox)
I want all of them to behave in the same manner in the "BeforeUpdate"
event.
Is there any method  to unify the code of the Event procedure, rather
than repeating it for every TextBox I have?
I know this is possible through class modules, but how?
Thanks
John Welch - 08 Dec 2005 18:23 GMT
Create a sub in the form's module (same place as the event code) and call it
whatever you want:
Private Sub DoStuffForTextBoxes
   ... put the code you want run here
End Sub

then in the before update event just say:
DoStuffForTextBoxes
and it will call your procedure.
If you need to send a value to the procedure, you can do that as well:
Check out the help on passing an argument to a function or subroutine.

>I have many TextBoxes in my form (about 14 TextBox)
> I want all of them to behave in the same manner in the "BeforeUpdate"
[quoted text clipped - 3 lines]
> I know this is possible through class modules, but how?
> Thanks
Marshall Barton - 08 Dec 2005 23:09 GMT
>I have many TextBoxes in my form (about 14 TextBox)
>I want all of them to behave in the same manner in the "BeforeUpdate"
>event.
>Is there any method  to unify the code of the Event procedure, rather
>than repeating it for every TextBox I have?
>I know this is possible through class modules, but how?

You don't actually need a BeforeUpdate procedure for each
text box.  Instead you can call your function by using
    =Functionname()
in each of the text box's Before Update **property**

If the function needs to "know" which text boxes the
function is operating on, it can refer to it by using:
    Me.ActiveControl

Signature

Marsh
MVP [MS Access]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.