M.8. Pop-Up Memo Workspace Form with Spell Check
Sometimes you want to give your user more room to enter long text into a memo field. Instead of using the built-in Access zoom feature, you can include a "workspace" feature to zoom into a memo field, allow the user to OK or Cancel his changes, and even spell-check the text. This zoom feature is shown on the Comments memo field in Figure M-14.
The following code in the double-click event of the memo field on frmBusiness is simple:
Private Sub BusinessComments_DblClick(Cancel As Integer) On Error GoTo Error_Handler Workspace Me.ActiveControl, Me Exit_Procedure: Exit Sub Error_Handler: DoCmd.SetWarnings True DisplayUnexpectedError Err.Number, Err.Description Resume Exit_Procedure Resume End Sub
Figure M.14. Figure m-14
The code in the Workspace procedure (which is in a standalone module such as basGlobal) looks like this:
Sub Workspace(ctl As Control, CallingForm As Form) On Error GoTo Err_Workspace CallingForm.Refresh 'Save any data which may have been entered into memo field Set gctlWorkspaceSource = ctl If ctl.Locked Or Not ctl.Enabled Then DoCmd.OpenForm "frmWorkspace", WindowMode:=acDialog, _ OpenArgs:="ReadOnly" Else DoCmd.OpenForm "frmWorkspace", WindowMode:=acDialog End If If IsLoaded("frmWorkspace") Then gctlWorkspaceSource = Forms.frmWorkspace.txtWorkspace DoCmd.Close acForm, "frmWorkspace" End If Exit_Workspace: Exit Sub ...
Get Access™ 2007 VBA Programmer's Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.