Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19

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

  1. #16
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Ottawa, Ontario, Canada; West Palm Beach FL

    I'm sure it's helpful. I'm just not sure where it would go in the code.
    I'd like to go through the forms and review each control. I think setting up the recursive look at subform controls
    would help.

    Thank you for the code.

  2. #17
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Ottawa, Ontario, Canada; West Palm Beach FL
    I was able to get all forms/subform/subsubform controls identified with the code I put together last night.
    The following are the results of sub testActive 
     to review forms and controls 
    Main/Sub         Form      ControlName   ControlType
    MainControl(0)  FormTestAudit  TabCtl0  123  TabControl
    MainControl(1)  FormTestAudit  Employee  124  Page
    MainControl(2)  FormTestAudit  EmployeeId  109  TextBox
    MainControl(3)  FormTestAudit  Label3  100  Label
    MainControl(4)  FormTestAudit  LastName  109  TextBox
    MainControl(5)  FormTestAudit  Label4  100  Label
    MainControl(6)  FormTestAudit  FirstName  109  TextBox
    MainControl(7)  FormTestAudit  Label5  100  Label
    MainControl(8)  FormTestAudit  Gender  109  TextBox
    MainControl(9)  FormTestAudit  Label6  100  Label
    MainControl(10)  FormTestAudit  Title  109  TextBox
    MainControl(11)  FormTestAudit  Label7  100  Label
    MainControl(12)  FormTestAudit  HrlyRate  109  TextBox
    MainControl(13)  FormTestAudit  Label8  100  Label
    MainControl(14)  FormTestAudit  DepartmentId  109  TextBox
    MainControl(15)  FormTestAudit  Label9  100  Label
    MainControl(16)  FormTestAudit   Department  124  Page
    MainControl(17)  FormTestAudit  frmDepartmentSubform  112  SubForm
    -Subform name(1)  frmDepartmentSubform
        SubControl(1) DepartmentID  controlType 109  TextBox
        SubControl(2) DepartmentID_Label  controlType 100  Label
        SubControl(3) Department  controlType 109  TextBox
        SubControl(4) Department_Label  controlType 100  Label
        SubControl(5) CostCenter  controlType 109  TextBox
        SubControl(6) CostCenter_Label  controlType 100  Label
    MainControl(18)  FormTestAudit   Cafeteria Items  124  Page
    MainControl(19)  FormTestAudit  FrmOrderSubform  112  SubForm
    -Subform name(2)  FrmOrderSubform
        SubControl(1) EmployeeID  controlType 109  TextBox
        SubControl(2) EmployeeID_Label  controlType 100  Label
        SubControl(3) OrderID  controlType 109  TextBox
        SubControl(4) OrderID_Label  controlType 100  Label
        SubControl(5) OrderDate  controlType 109  TextBox
        SubControl(6) OrderDate_Label  controlType 100  Label
        SubControl(7) frmOrderSubSubform  controlType 112  SubForm
    ---SubSubForm name (1)  frmOrderSubSubform
            SubSubControl(1) EmployeeID  controlType 112  TextBox
            SubSubControl(2) EmployeeID_Label  controlType 112  Label
            SubSubControl(3) OrderID  controlType 112  TextBox
            SubSubControl(4) OrderID_Label  controlType 112  Label
            SubSubControl(5) ItemId  controlType 112  TextBox
            SubSubControl(6) ItemId_Label  controlType 112  Label
            SubSubControl(7) Qty  controlType 112  TextBox
            SubSubControl(8) Qty_Label  controlType 112  Label
            SubSubControl(9) Price  controlType 112  TextBox
            SubSubControl(10) Price_Label  controlType 112  Label
            SubSubControl(11) SubTotal  controlType 112  TextBox
            SubSubControl(12) SubTotal_Label  controlType 112  Label
            SubSubControl(13) Item  controlType 112  ComboBox
            SubSubControl(14) Item_Label  controlType 112  Label
            SubSubControl(15) OrderDetailID  controlType 112  TextBox
            SubSubControl(16) Label17  controlType 112  Label
            SubSubControl(17) OrderSubTotal  controlType 112  TextBox
        SubControl(8) OrderTotal  controlType 109  TextBox
        SubControl(9) Label11  controlType 100  Label
    MainControl(20)  FormTestAudit  txtNameAtTop  109  TextBox
    I will continue to work with the code you provided to see if I can use it in the audit trail material to get the proper form and controls and get passed the 2474 error. It's a learning exercise in an area that I haven't dealt with in depth.

  3. #18
    Ajax is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    good luck, I'm off for a break this weekend and probably won't have time to do anything more than grunt tomorrow whilst trying to clear my desk!

  4. #19
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Ottawa, Ontario, Canada; West Palm Beach FL
    We are heading back to Canada in the next few days, so I won't be as active on the forum or the computer.
    I did try your code with my form open and put the cursor in a subform control.
    I had it print the following:

    Active Form:FormTestAudit ActiveControl:OrderDate ControlType:TextBox
    theActiveSubform Is FrmOrderSubform

    So I have a bit of a start. A few days away may help the old 'noggin'.

    Enjoy your weekend.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 02-18-2016, 11:06 AM
  2. Replies: 7
    Last Post: 12-18-2015, 10:43 AM
  3. Replies: 8
    Last Post: 06-19-2015, 01:19 AM
  4. Control source Expression giving #Error
    By N3w2access in forum Forms
    Replies: 5
    Last Post: 01-21-2014, 06:53 AM
  5. Replies: 13
    Last Post: 12-05-2011, 04:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Tech Forums: Microsoft Office Forums