Results 1 to 4 of 4
  1. #1
    alikona is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2019
    Posts
    15

    Active window error

    Hi all,

    I have a form (frm_OrderDetails) with a subform (subf_LineItems) in a subform control (LineItems). The subform is in datasheet mode. In the Line Item table (tbl_LineItems), there is a field for comments (LineComments). Since the comments can be rather long sometimes, I wanted an easier way to display/enter/edit then that having the person scrolling on the datasheet view for each line.

    I have an unbound text box (txtLineCommentLink) on my main form that is linked through VBA to the LineComments field. Everything seems to work correctly - displaying/updating but when I close out of my main form I get an error message. This only happens when I make edits to the txtLineCommentLink box. Despite the error, the changes are being saved. Does anyone have any ideas on a solution around this error message? I don't want to confuse my end users.



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

    Code:

    This is on the AfterUpdate event for the unbound textbox on my main form.
    Code:
    Private Sub txtLineCommentLink_AfterUpdate()
    Me.[LineItems].Form![LineComments] = Me.txtLineCommentLink
    End Sub
    This is in the Current event on my subform, subf_LineItems
    Code:
    Private Sub Form_Current()
    Me.Parent.[txtLineCommentLink] = Me.LineComments
    End Sub

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    Could you try to save both forms (main and sub) after you edit the comments:
    Code:
    Private Sub txtLineCommentLink_AfterUpdate()
    Me.[LineItems].Form![LineComments] = Me.txtLineCommentLink
    Me.[LineItems].Form.Dirty=False
    Me.Dirty=False
    End Sub
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    alikona is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2019
    Posts
    15
    Thank you, that seems to have solved it

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 02-15-2018, 12:10 AM
  2. OLE or Active X Control Error
    By WCStarks in forum Forms
    Replies: 6
    Last Post: 01-29-2018, 05:27 PM
  3. Replies: 18
    Last Post: 04-20-2017, 04:09 PM
  4. Replies: 21
    Last Post: 01-21-2014, 05:04 PM
  5. Replies: 1
    Last Post: 01-11-2014, 12:39 PM

Posting Permissions

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