Stuart Sanders
stuart at pacific.net.hk
Mon Feb 24 06:56:00 CST 2003
hehe ... don't forget to remove the Hello World msgbox from the sample I
provided.
----- Original Message -----
From: <marcel.vreuls at achmea.nl>
To: <accessd at databaseadvisors.com>
Sent: Monday, February 24, 2003 8:05 PM
Subject: TNXS Solution: [AccessD] Programmaticly fill control events
>
> Hi Group,
>
> In all replies I received on my question I copied the parts I thought I
> could use. Further more some existing code fo mine. I made this function.
> perhaps someone else can use this as well :-). Many thanks to all. This
> saves me about 2000 mouse clicks en several hours of dumb work!!!!
>
>
> Grtz. marcel
>
>
> Sub fncAddFunctionality(frm As Form)
> 'Function: Add generic code behind a control
> 'Specials: -change the event, standard to click
> ' : -change/add insertlines to desired code
> ' : -add more controltypes in the IF-then statement.
> ' : - next to code you can also set custom properties of the control
like height, font, etc.
> 'All possible controltypes.
> 'acLabel Label
> 'acRectangle Rechthoek
> 'acLine Lijn
> 'acImage Figuur
> 'acCommandButton Opdrachtknop
> 'acOptionButton Keuzerondje
> 'acCheckBox Selectievakje
> 'acOptionGroup Groepsvak
> 'acBoundObjectFrame Kader voor afhankelijk object
> 'acTextBox Tekstvak
> 'acListBox Keuzelijst
> 'acComboBox Keuzelijst met invoervak
> 'acSubform Subformulier / subrapport
> 'acObjectFrame Kader voor niet-afhankelijk object of grafiek
> 'acPageBreak pagina - einde
> 'acPage Page-object (pagina in tabbesturingselement)
> 'acCustomControl ActiveX-besturingselement (aangepast
besturingselement)
> 'acToggleButton Wisselknop
> 'acTabCtl Tabblad '
>
> Dim ctl As Control
> Dim lngLine As Long
>
> DoCmd.OpenForm frm.Name, acDesign, , , , acHidden
>
> 'Elementen in Controls-collectie opsommen.
> For Each ctl In frm.Controls
> ' Controleren of besturingselement een tekstvak is.
> If ctl.ControlType = acCommandButton Then
> ' Eigenschappen besturingselement instellen.
> With ctl
> ' .Enabled = True
> ' .Height = 400
> ' .SpecialEffect = 0
> End With
> lngLine = frm.Module.CreateEventProc("Click", ctl.Name)
> With frm.Module
> .InsertLines lngLine + 1, "' Purpose: commentline for this
code"
> .InsertLines lngLine + 2, "On Error Resume Next"
> .InsertLines lngLine + 3, vbTab & "msgbox ""Hello World"""
> End With
> End If
> Next ctl
>
> DoCmd.Save acForm, frm.Name
> DoCmd.Close acForm, frm.Name
> End Sub
>
>
>
>
> ********************* DISCLAIMER *********************
> De informatie in dit e-mail bericht is uitsluitend
> bestemd voor de geadresseerde. Verstrekking aan
> en gebruik door anderen is niet toegestaan.
> Door de electronische verzending van het bericht
> kunnen er geen rechten worden ontleend aan de
> informatie.
> ************************************************************
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>