Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / June 2007

Tip: Looking for answers? Try searching our database.

Shifting focus between forms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter Hallett - 24 Jun 2007 18:40 GMT
Form “frm_A” has a sub-form “sfrm_A”.  Both are bound to tables with the
usual one:many relationship.  Form frm_A lists customers.  Sub-form sfrm_A
lists their transactions.  Both frm_A and sfrm_A have navigation bars
allowing customers and their transactions to be viewed and data to be
entered.  To facilitate this, the focus is located by default in the sub-form
control that normally receives the first data input – say ‘Control_sfA’.

In straightforward cases, this works fine.  As the main form navigation
buttons are used to move from customer to customer, and the sub-form
navigation buttons are used to move from transaction to transaction, the
cursor remains in the respective Control_sfAs, as required.

Certain customers are, however, associated with particular types of
transactions that require the display of additional information.  This is
presented in an independent pop-up form, “frm_B” which is invoked from sfrm_A
and opened or closed appropriately as the main navigation buttons are used to
move from customer to customer.  This again works fine but when frm_B, a
continuous form, is open, the focus resides on its first control and cannot
be returned to Control_sfA by any means that I can devise.  Commands of the
form ‘Forms![frm_A]![sfrm_A].Setfocus’, or any variation thereof that the
compiler will accept in Sub Form_Open or Sub Form_Current of frm_B, do
nothing.  The focus stubbornly remains on the first control of frm_B,
although it can be manually moved to Control_sfA, in sfrm_A, by clicking on
the latter.

Can anyone suggest a way of automatically retaining the focus in sfrm_A when
frm_B is open?

Signature

Peter Hallett

tina - 24 Jun 2007 19:31 GMT
1. make sure that frm_B's Modal property is set to No, and that the OpenForm
code does not override that setting.

2. add code to the procedure that opens frm_B, *after* the OpenForm code, to
return the focus to frm_A, as

   DoCmd.SelectObject acForm, "frm_A", False

if necessary, follow that line of code with two more lines of code, to set
the focus first to the subform control in frm_A, and then to the control
within the subform.

hth

> Form "frm_A" has a sub-form "sfrm_A".  Both are bound to tables with the
> usual one:many relationship.  Form frm_A lists customers.  Sub-form sfrm_A
[quoted text clipped - 11 lines]
> transactions that require the display of additional information.  This is
> presented in an independent pop-up form, "frm_B" which is invoked from
sfrm_A
> and opened or closed appropriately as the main navigation buttons are used to
> move from customer to customer.  This again works fine but when frm_B, a
[quoted text clipped - 8 lines]
> Can anyone suggest a way of automatically retaining the focus in sfrm_A when
> frm_B is open?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.