Zoom Box Font

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

Jeanette,

Thank you. The code works good. How do I get the text (edited) from
the zoom control back into the fidld/form that called frmZoom?

Thanks,
Bob
 
More:

I've set frmZoom to open Modal, which prevents it from being left open
and causing the code to complain.. I've created a global variable
(strZoomBoxText ) that is set when frmZoom is closed and = frmZooms
text entry. When the originating form calls the zoom routine, the
final line sets/resets the controls text to frmZoom's value. It seems
the code(cc2_DblClick) is 'waiting' for frmZoom to close before it can
finish.


Private Sub cc2_DblClick(Cancel As Integer)
'http://groups.google.com/group/microsoft.public.access/
browse_thread/thread/41074288a51680ae?hl=en#
On Error GoTo cc2_DblClick_Error
' Initally, var below set to zero length.
strZoomBoxText = ""
If Me.Dirty Then Me.Dirty = False
If Len(Me.cc2 & vbNullString) > 0 Then
Zoomspace Me.ActiveControl
Me.cc2 = strZoomBoxText
End If

ExitHere:
Exit Sub

cc2_DblClick_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") " _
& "in procedure cc2_DblClick of VBA Document Form_frmDenial"
End Sub
 
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
 
Back
Top