My zoom box is set up to be read only.
I have different code to do a similar thing where you can edit the text.
This solution was provided by Armen Stein at an office developers conference
in Sydney in 2008.
I find it very easy to use.
The form that opens to allow edits is called frmWorkspace.
It has a memo field called txtWorkspace.
The global constant is called pctlWorkspaceSource.
On the load event of frmWorkspace-->
-------------------------------
Private Sub Form_Load()
Dim ctl As Control
'Import data into workspace
Me!txtWorkspace = pctlWorkspaceSource
If Me.OpenArgs = "ReadOnly" Then
Set ctl = Me!txtWorkspace
With ctl
'.Enabled = False
.EnterKeyBehavior = False 'Sets to Default / No new line in
field
.Locked = True
.BackColor = vbButtonFace
End With
Set ctl = Nothing
End If
End Sub
-----------------------------
Here is the code that goes in a standard module.
--------------------------------------------------------
Public Sub Workspace(ctl As Control, CallingForm As Form)
On Error GoTo Err_Handler
Dim bReadOnly As Boolean
CallingForm.Refresh
'Save any data which may have been entered into memo field
Set pctlWorkspaceSource = ctl
If ctl.Locked Or Not ctl.Enabled Then
bReadOnly = True
DoCmd.OpenForm "frmWorkspace", , , , , acDialog, "ReadOnly"
Else
DoCmd.OpenForm "frmWorkspace", , , , , acDialog
End If
If IsLoaded("frmWorkspace") Then
If Not bReadOnly Then 'Don't attempt to update the control if it
was read only
pctlWorkspaceSource = Forms.frmWorkspace.txtWorkspace
End If
DoCmd.Close acForm, "frmWorkspace"
End If
Exit_Handler:
Exit Sub
Err_Handler:
Select Case Err
Case 3163
'Too much data for field
MsgBox "The field is too small to accept the amount of data you
attempted to insert. " _
& "As a result, the operation has been cancelled.",
vbInformation, MTitle
Resume Next
Case Else
MsgBox Err.Number & ", " & Err.Description
Resume Exit_Handler
End Select
End Sub