Prev: Textbox Character Counter
Next: forms
From: Linq Adams via AccessMonster.com on 20 Jan 2010 20:45 When you move controls from the form's Detail Section directly to a page of the tabbed control, you do, indeed, need to "reconnect" the controls and their event codes. Courtesy of ADezii at Bytes.com, this code will "reconnect" controls to some selected Events (OnClick and AfterUpdate in this example.) It can be modified for other Events, and has the advantage of updating a large number of controls without doing them one by one. Private Sub Form_Load() Dim ctl As Control For Each ctl In Me.Controls If (TypeOf ctl Is TextBox) Or (TypeOf ctl Is ComboBox) Then If ctl.OnClick = "" Then ctl.OnClick = "[Event Procedure]" End If End If Next For Each ctl In Me.Controls If (TypeOf ctl Is TextBox) Or (TypeOf ctl Is ComboBox) Then If ctl.AfterUpdate = "" Then ctl.AfterUpdate = "[Event Procedure]" End If End If Next End Sub Alternatively, in Design View, you can select a control, go into Properties - Events and click on the event in question, to take you to the code window, as if you were setting it up for the first time. Once in the code window, simply return to Design View. The control is now "connected" to its code and the hotkey will work. The disadvantage to this is that it's time consuming if it have moved a lot of controls. As for you other question, referencing a control placed directly on a tabbed page is done in the exact same way as referencing a control on the detail section; the tabbed control doesn't change this. This does not apply to a control on a subform on a tabbed page! Controls on subforms (whether on tabbed pages or not) are another thing entirely. -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via http://www.accessmonster.com |