Senin, 28 September 2015

Re: [MS_AccessPros] Using Screen.ActiveControl.Name to determine focus

 

Hi Rod,

> "Not sure about global variable (not my favorite approach to programming)."

I agree about not using global variables -- their values get lost if there is an unhandled error.  How about using a Tempvar or a database property?  My preference is to use database properties.

You can put code in the subform control On Enter and On Exit events

warm regards,
crystal

Microsoft MVP Virtual Conference 2015 -- Access Web Apps, linking to SQL Azure from Access desktop, Excel workbook, and SSMS (53 minutes)
https://channel9.msdn.com/events/MVP-Virtual-Conference/MVP-Virtual-Conference-Americas-2015/CONS2-Using-Access-and-SharePoint-for-Travel-Expenses-and-Pulling-up-Maps

~ have an awesome day ~

On 9/27/2015 9:11 PM, desertscroller@cox.net [MS_Access_Professionals] wrote:
I am using a main form with several subforms.  The On Current events run when the main form record is changed.  However, I am trying to restrict some of the code unless the subform has focus.  The code that I was trying is  (code located in the subform)

   ' Set Total Amount Due if Billing Form has focus
   If Screen.ActiveControl.Name = "frmBillings" Then
      Tbox_TotalAmtDue.Value = tmpBalanceDue
   End If

However, I get the following message

Error 2474: The expression you entered requires the control to be in the active window.

Is there an approach that will accomplish such a process?  Not sure about global variable (not my favorite approach to programming).

Using Windows 10, 8.1 and 7 with access 2010.
Rod





__._,_.___

Posted by: crystal 8 <strive4peace2008@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

.

__,_._,___

Tidak ada komentar:

Posting Komentar