May 2007
Intermediate to advanced
1152 pages
30h 53m
English
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
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 ...Read now
Unlock full access