Patricio Galleguillos
pgalleguillos at plus.cl
Mon Feb 24 06:26:00 CST 2003
Hi Marcel and Group Case you need more input, made a small A2000 - XP mdb with a 'mini sample', if you (or anyone) want to take a look, mail off line Saludos Cordiales, Patricio Galleguillos pgallegu at chilesat.net -----Mensaje original----- De: accessd-admin at databaseadvisors.com [mailto:accessd-admin at databaseadvisors.com] En nombre de marcel.vreuls at achmea.nl Enviado el: lunes, 24 de febrero de 2003 9:06 Para: accessd at databaseadvisors.com Asunto: 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