Thanks Crystal and Bill. I do use error handling (but not quite everywhere but will work on it). Using the On Enter event is one I had never thought of, really handy. Thanks again. Everything appears to be functioning the way I wanted.
Rod
---In MS_Access_Professionals@yahoogroups.com, <wrmosca@...> wrote :
Although global variables are lost with unhandled errors in an mdb or accdb, they are not lost in compiled mde and accde files. Just thought you all should know this. I rarely rely on them anyway. I use them for such things as permissions but check them from within each object.
---In MS_Access_Professionals@yahoogroups.com, <strive4peace2008@...> wrote :
But it is best practice to handle all errors, even the unexpected.
Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
Microsoft Office Access MVP
https://mvp.support.microsoft.com/profile=C4D9F5E7-BB03-4291-B816-64270730881E
My nothing-to-do-with-Access blog
http://wrmosca.wordpress.com
---In MS_Access_Professionals@yahoogroups.com, <strive4peace2008@...> wrote :
Hi Rod,
> "Not sure about global variable (not my favorite approach toprogramming)."
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@... [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: desertscroller@cox.net
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (4) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar