O'Reilly logo

Access™ 2007 VBA Programmer's Reference by Armen Stein, Geoffrey Griffith, Rob Cooper, Teresa Hennig

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required