Results 1 to 5 of 5
  1. #1
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Popup form used for memo error message on close

    Hi, I have a popup form that uses a memo field on my form and you can edit/view in a much larger window that on the form.


    I am getting a error message when I close the popup form:
    Field on Customers form control source (Customer Notes) named (Notes)
    Field on form (frmCustomerNotes) is unbound. Name (TxtDescription)

    Error message is; Run-time error '2185'
    You can't reference a property or method for a control unless the control has the focus.

    Private Sub Form_Close()
    Forms![Customers]![Customer Notes] = Forms![frmCustomerNotes]![TxtDescription]
    TxtDescription.SelStart = Len(Notes) 'HERE IS WHERE CODE ERRORS OUT AT.
    DoCmd.Close
    End Sub

    Private Sub Form_Open(Cancel As Integer)
    Forms![frmCustomerNotes]![TxtDescription] = Forms![Customers]![Customer Notes]
    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Which form is each procedure behind?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Pic of Popup, notice memo field to right that it will update on main form.

    Main form is Customers where I use a command button to open the popup form:
    Private Sub Command367_Click()
    On Error GoTo Err_Command210_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmCustomerNotes"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Exit_Command210_Click:
    Exit Sub

    Err_Command210_Click:
    MsgBox Err.Description


    Resume Exit_Command210_Click


    Ok, popup form is open and you can enter any changes or whatever you want.Then when the form closes is where the error come in. Here is the close code:
    This is for the form frmCustomerNotes

    Private Sub Form_Close()
    Forms![Customers]![Customer Notes] = Forms![frmCustomerNotes]![TxtDescription]
    TxtDescription.SelStart = Len(Notes)
    DoCmd.Close
    Attached Thumbnails Attached Thumbnails popupform.jpg  

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    If you are closing frmCustomerNotes why bother with SelStart method on TxtDescription?

    Set focus to the control first.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Thanks, I wrote this in 1999 and it was in Access 97. My brain is just not working today.

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

Similar Threads

  1. Close button for message box
    By ashu.doc in forum Forms
    Replies: 1
    Last Post: 08-13-2012, 04:38 AM
  2. Replies: 15
    Last Post: 02-17-2012, 09:20 AM
  3. Replies: 6
    Last Post: 04-13-2011, 03:55 PM
  4. Replies: 2
    Last Post: 03-14-2011, 03:42 PM
  5. Message popup based on USERNAME
    By jpkeller55 in forum Access
    Replies: 3
    Last Post: 12-19-2010, 09:51 PM

Tags for this Thread

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