Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    lccrews is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Location
    Los Angeles
    Posts
    194

    Lightbulb How to build a pop-out text editor?

    I am looking to build some sort of text editor for my form. I have a form with a tab control to set up a document with many different parts to it. Certain parts have too many fields to have them full size on one tab alone and are too small for text editing beyond a short paragraph. For these fields, I would like to add a button that opens a full sized popup form for editing the text. When they are finished I'd like to add another button to transfer what they wrote back to the field on the tab. Is this possible?

    Example: [Text1] is too small so the user presses a button that opens a popup form with [Text2] being a full-size box. When they're done they hit another button on the popup that (a) transfers the text to [Text1] and (b) closes the popup.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'd just create a form bound to the same table but with only a textbox for the desired field. Behind a button or double click event I have:

    If Me.Dirty Then Me.Dirty = False
    DoCmd.OpenForm "frmMeetingsZoom", , , "MeetingNoteID = " & Me.MeetingNoteID, , acDialog

    and behind the close event of that form I requery the original form.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    lccrews is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Location
    Los Angeles
    Posts
    194
    Would I have to create one of these popups for each field? Also, I'm not too savvy with Access VB. Specifically I'm not familiar with the function 'dirty'.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No, you could use OpenArgs to pass the field name, and change the control source of the textbox in the form's open event.

    That first line just forces the record to save if necessary. A record is dirty if it's been edited.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    lccrews is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Location
    Los Angeles
    Posts
    194
    I'm struggling to understand what you're saying. To clarify, I create ONE form that will have that code behind the button. I can place buttons next to each field on my tabbed form that lead to this one form? I don't know how to write an OpenArg based on https://msdn.microsoft.com/en-us/vba...roperty-access. Sorry for the late response. I've been re-reading trying to make sense of it.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    This is probably more complicated than you need, as it passes two values:

    http://www.baldyweb.com/OpenArgs.htm

    In your case, you just pass a field name, and in the open event set the control source property of your textbox to the OpenArgs value.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    lccrews is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Location
    Los Angeles
    Posts
    194
    Ok, I've figured out how to get my field values to populate to "frm_TextEditor". Can you explain a little more on how I get the value from "frm_TextEditor" back to "frm_BP10_Tablet_ViewMBR" field [We01]?

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Since they're bound to the same table, you just requery the original form when you close the popup. In my case this is the code behind the close button:

    If Me.Dirty Then Me.Dirty = False
    Forms!frmMeetingNotes.Requery
    DoCmd.Close acForm, Me.Name
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,405
    This functionality is built into Access, not needing ANY code. Put your cursor in the target field and press Shift-F2.

  10. #10
    lccrews is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Location
    Los Angeles
    Posts
    194
    Thank you davergri!!!!! Wow. That is way simple. Thanks for the help Paul, but I'm gonna go with the simple solution.
    Attached Files Attached Files

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    That's true, I should have mentioned it. I still use the separate form when I want more control over it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Let me know if you want to continue with the form, and I'll point out why it's not working.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #13
    lccrews is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Location
    Los Angeles
    Posts
    194
    For the sake of learning, I'd like to know. You're right, there is a lack of control over the zoom feature. It works though. I'd just like to have a larger text box.

  14. #14
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You didn't use the wherecondition of OpenForm to open the popup to the desired record. You're trying to pass the value back and forth, which isn't as flexible as you're looking for. Where do you pass the value back to? You'd need to change that dynamically.

    I mentioned passing the field name, not the value, and then using that to set the control source of the textbox. I mentioned the open event, not the load event.

    The code to call it would look like:

    Code:
    Private Sub We02_DblClick(Cancel As Integer)    
        If Me.Dirty Then Me.Dirty = False
        DoCmd.OpenForm "frm_TextEditor", , , "MBRID = " & Me.MBRID, , acDialog, "We02"
    End Sub
    You missed the dialog setting, which will prevent the user from dirtying both forms. The code in the open event:

    Code:
    Private Sub Form_Open(Cancel As Integer)    
        If Not IsNull(Me.OpenArgs) Then
            Me.Text2.ControlSource = Me.OpenArgs
        End If
    End Sub
    And since your form can contain multiple records, a requery would return it to the first, so I switched to refresh:

    Code:
        If Me.Dirty Then Me.Dirty = False    
        Forms!frm_BP10_Tablet_ViewMBR.Refresh
        DoCmd.Close acForm, Me.Name
    Off to lunch!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  15. #15
    lccrews is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Location
    Los Angeles
    Posts
    194
    I hope you enjoyed your lunch! Thanks for all your help Paul. Everything works great and I have total control over the form.

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

Similar Threads

  1. Replies: 2
    Last Post: 01-10-2016, 06:47 PM
  2. Replies: 22
    Last Post: 12-17-2015, 11:50 AM
  3. Open VBA editor
    By abhijeetkadam in forum Security
    Replies: 1
    Last Post: 11-19-2014, 08:10 AM
  4. HTML Editor
    By mystifier in forum Forms
    Replies: 3
    Last Post: 11-11-2010, 05:51 AM
  5. Text editor
    By smiles_chicago in forum Forms
    Replies: 0
    Last Post: 10-21-2008, 12:38 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