[AccessD] vba generic code move focus to next control

Kath Pelletti kp at sdsonline.net
Sun Jul 13 18:45:16 CDT 2008


Thanks for that, but that's not the case...... not when you use 
me.parent.requery which takes the focus away from the subform.

Kath
----- Original Message ----- 
From: "A.D.Tejpal" <adtp at airtelmail.in>
To: "Access Developers discussion and problem solving" 
<accessd at databaseadvisors.com>
Sent: Friday, July 11, 2008 4:21 PM
Subject: Re: [AccessD] vba generic code move focus to next control


> Kath,
>
>    Although programmatic generic solution for forcing focus to next 
> control is available, it should not be necessary in your case.
>
>    In Tools > Options, make sure that on Keyboard tab, Move After Enter is 
> set to Next Field. With this, the focus after update action will move to 
> the next control. No special code would be needed. Your existing statement 
> for setting the focus to current control is also apparently redundant.
>
> Best wishes,
> A.D.Tejpal
> ------------
>
>  ----- Original Message ----- 
>  From: Kath Pelletti
>  To: Access D Normal List
>  Sent: Friday, July 11, 2008 07:49
>  Subject: [AccessD] vba generic code move focus to next control
>
>
>  Hi all -
>
>  I am looking for some code/command to move focus to the next control on a 
> subform . Before I start mucking around with retrieving the tab index for 
> the current control and trying to use that to move to the next one, just 
> want to check. Am I missing something simple? Is there some simple command 
> or code which would do something like 'GotoControl - Next?'
>
>  I could (of course) nominate the name of the control I want to go to but 
> as I will need to use this code for many controls, i want something 
> generic.
>  tia
>  Kath
>
>  Existing code for subcontrol:
>
>  --------------------------------------------------------------------------------
>
>  Private Sub SpecialDiet_AfterUpdate()
>  Dim strerrormsg As String
>  On Error GoTo Err_Handler
>
>  Me.DateLastRevised = CurrentDate()
>  Me.Parent.Requery
>  Me.SpecialDiet.setfocus
>  'TAB  TO NEXT CONTROL
>
>  Normal_exit:
>      DoCmd.SetWarnings True
>      Exit Sub
>  Err_Handler:
>      MsgBox "Error: [" & Err.Number & "]  " & IIf(Len(strerrormsg) > 0, 
> strerrormsg, Err.Description), vbCritical, "Error Message"
>      Resume Normal_exit
>  End Sub
>  ______________________________________
>  Kath Pelletti
>  Software Design and Solutions Pty Ltd
>  Ph: 9505-6714
>  Fax: 9505-6430
>  kp at sdsonline.net
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 





More information about the AccessD mailing list