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
|
|||
|
|||
Tabbing between subforms using datasheet view
I have a form with four subforms using the Datasheet default view for each.
I am having difficulty creating a cohesive tab order. The subforms have various numbers of fields, but what I would like is constant. I am trying to set the focus on the first field of a new record row for each subform. When tabbing from the last field of a record in one subform, I am trying to get my focus to be set on the next adjacent subform, new record row, field one instead of it creating a new record within the current subform. I have tried using the setfocus function and the lost focus, on got focus, and on activate events. But I have been unsuccessful so far in getting my tabs to flow smoothly. Any help would be greatly appreciated. |
#2
|
|||
|
|||
Tabbing between subforms using datasheet view
Hi Rocky,
Here is some code to switch to another subform when TAB is pressed in a particular control... '~~~~~~~~~~~~~~~~~~ Private Sub Controlname_KeyPress(KeyAscii As Integer) If KeyAscii = 9 Then Me.Parent.SubformControlname.SetFocus Me.Parent.SubformControlname.form.Controlname.SetF ocus End If End Sub '~~~~~~~~~~~~~~~~~~ on adding a new record... The problem with using DoCmd.GoToRecord , , acNewRec is that you are not explicitly specifying WHERE to add the record...so use the Recordset AddNew method instead '~~~~~~~~~~~~~~~~~~ 'add new record to another subform me.parent.SubformControlname.Form.Recordset.AddNew '~~~~~~~~~~~~~~~~~~ Warm Regards, Crystal * (: have an awesome day * MVP Access Remote Programming and Training strive4peace2006 at yahoo.com * Rocky Beach wrote: I have a form with four subforms using the Datasheet default view for each. I am having difficulty creating a cohesive tab order. The subforms have various numbers of fields, but what I would like is constant. I am trying to set the focus on the first field of a new record row for each subform. When tabbing from the last field of a record in one subform, I am trying to get my focus to be set on the next adjacent subform, new record row, field one instead of it creating a new record within the current subform. I have tried using the setfocus function and the lost focus, on got focus, and on activate events. But I have been unsuccessful so far in getting my tabs to flow smoothly. Any help would be greatly appreciated. |
Thread Tools | |
Display Modes | |
|
|