If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Moved Form Data to Tab Control
Hi All,
I recently moved all of my form fields to a tabbed control. The reason i did this was to utilize a subform. My main problem now is that none of my code is working on the form now. Can some explain why none of the old code works now and how i can go about getting it to work. Thanks |
#2
|
|||
|
|||
Moved Form Data to Tab Control
You've likely made your form into a subform. Let's say your tab control is
housed on frmTab, your old form was frmMyForm. Your old code likely referenced a control on your old form as Forms!frmMyform!MyControl. To reference that control now you have to use Forms!frmTab!frmMyform!MyControl. Regards Kevin "scott04" wrote in message ... Hi All, I recently moved all of my form fields to a tabbed control. The reason i did this was to utilize a subform. My main problem now is that none of my code is working on the form now. Can some explain why none of the old code works now and how i can go about getting it to work. Thanks |
#3
|
|||
|
|||
Moved Form Data to Tab Control
If the controls in question were simply moved from the form's Detail Section
directly to a page of the tabbed control, you 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 involves a lot of controls. -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200911/1 |
#4
|
|||
|
|||
Moved Form Data to Tab Control
Thank you for that information...i simply strarted from scratch with the
form...created the tabs and then migrated my code...now everything seems to work...thank you "kc-mass" wrote: You've likely made your form into a subform. Let's say your tab control is housed on frmTab, your old form was frmMyForm. Your old code likely referenced a control on your old form as Forms!frmMyform!MyControl. To reference that control now you have to use Forms!frmTab!frmMyform!MyControl. Regards Kevin "scott04" wrote in message ... Hi All, I recently moved all of my form fields to a tabbed control. The reason i did this was to utilize a subform. My main problem now is that none of my code is working on the form now. Can some explain why none of the old code works now and how i can go about getting it to work. Thanks . |
Thread Tools | |
Display Modes | |
|
|