Configuring the ACCESS Zoom Box

S

SJ

Hi there,
when you press <SHIFT F2> the Zoom box appears with the text in the current
field.

Problem(s) for users is this,

1. The text is always highlighted, meaning a single keystroke can over
write all the data...

2. To create a new line in the Zoom Box, the user needs to press <CTRL
ENTER> instead of just ENTER...

I know it's a matter of training but that doesn't seem an option here. you
know how it is...

Does anyone know how to configure the Zoom Box to leave the cursor at the
end of the field, with the text NOT highlighted and to make it so that a new
line in the Zoom Box is created by ENTER only???

thx
 
A

Allen Browne

I don't know any way to configure the zoom box, but it is not hard to
replace it with one you can configure.

This is untested and incomplete, but the basic idea:

1. Create a unbound form (no table), with a single large text box.

2. Create an AutoExec macro, and put this in the MacroNames column:
+{F2}
In the Action colunmn, enter your function name, such as:
=FireZoomBox()
Save the macro with the name AutoKeys. (The name is important.)

3. In a standard module, write the function to copy the text from the active
control to the big unbound text box, and keep track of the name of the
previous control:

Public gctlZoomTarget As Control
Function FireZoomBox()
gctlTarget = Screen.ActiveControl
DoCmd.OpenForm "frmZoom", WindowMode:=acDialog, _
OpenArgs:= gctlZoomTarget.Value
End Function

4. In the Load event of the zoombox, copy the value from OpenArgs to the big
text box.

5. In the Click event of your Ok command button on your zoom form:
If Not gctlZoomTarget Is Nothing Then
gctlZoomTarget.Value = Me.[MyBigTextbox]
End If

That will certainly need refining and error handling, because the
ActiveControl might be a a command button or something which has no Value.

You can then control it anyway you want, e.g. using SelStart and SelLength
to define what is initially selected, and setting the EnterKeyBehavior of
the ext box.
 
S

SJ

Hi Allan,
I couldn't quite understand points 2 and 3...

I allready have an AutoExec macro...

I couldn't find the "MacroNames" column.

The Action column ONLY lets me select from a set list...

I was wondering if you forgot to mention a step, therefore making me quite
lost...

sorry for the inconvenience...

oh yes, one other point, the ACCESS Zoom Box knows if a control is read
only, as I can't get this working, will it know, if I can get it working
then I can test that....


Allen Browne said:
I don't know any way to configure the zoom box, but it is not hard to
replace it with one you can configure.

This is untested and incomplete, but the basic idea:

1. Create a unbound form (no table), with a single large text box.

2. Create an AutoExec macro, and put this in the MacroNames column:
+{F2}
In the Action colunmn, enter your function name, such as:
=FireZoomBox()
Save the macro with the name AutoKeys. (The name is important.)

3. In a standard module, write the function to copy the text from the
active control to the big unbound text box, and keep track of the name of
the previous control:

Public gctlZoomTarget As Control
Function FireZoomBox()
gctlTarget = Screen.ActiveControl
DoCmd.OpenForm "frmZoom", WindowMode:=acDialog, _
OpenArgs:= gctlZoomTarget.Value
End Function

4. In the Load event of the zoombox, copy the value from OpenArgs to the
big text box.

5. In the Click event of your Ok command button on your zoom form:
If Not gctlZoomTarget Is Nothing Then
gctlZoomTarget.Value = Me.[MyBigTextbox]
End If

That will certainly need refining and error handling, because the
ActiveControl might be a a command button or something which has no Value.

You can then control it anyway you want, e.g. using SelStart and SelLength
to define what is initially selected, and setting the EnterKeyBehavior of
the ext box.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

SJ said:
Hi there,
when you press <SHIFT F2> the Zoom box appears with the text in the
current field.

Problem(s) for users is this,

1. The text is always highlighted, meaning a single keystroke can over
write all the data...

2. To create a new line in the Zoom Box, the user needs to press <CTRL
ENTER> instead of just ENTER...

I know it's a matter of training but that doesn't seem an option here.
you know how it is...

Does anyone know how to configure the Zoom Box to leave the cursor at the
end of the field, with the text NOT highlighted and to make it so that a
new line in the Zoom Box is created by ENTER only???

thx
 
D

Douglas J. Steele

To get the MacroNames column added, check it on the View menu.

In step 2, select RunCode as the action, and put FireZoomBox() as the
function name.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


SJ said:
Hi Allan,
I couldn't quite understand points 2 and 3...

I allready have an AutoExec macro...

I couldn't find the "MacroNames" column.

The Action column ONLY lets me select from a set list...

I was wondering if you forgot to mention a step, therefore making me
quite lost...

sorry for the inconvenience...

oh yes, one other point, the ACCESS Zoom Box knows if a control is read
only, as I can't get this working, will it know, if I can get it
working then I can test that....


Allen Browne said:
I don't know any way to configure the zoom box, but it is not hard to
replace it with one you can configure.

This is untested and incomplete, but the basic idea:

1. Create a unbound form (no table), with a single large text box.

2. Create an AutoExec macro, and put this in the MacroNames column:
+{F2}
In the Action colunmn, enter your function name, such as:
=FireZoomBox()
Save the macro with the name AutoKeys. (The name is important.)

3. In a standard module, write the function to copy the text from the
active control to the big unbound text box, and keep track of the name of
the previous control:

Public gctlZoomTarget As Control
Function FireZoomBox()
gctlTarget = Screen.ActiveControl
DoCmd.OpenForm "frmZoom", WindowMode:=acDialog, _
OpenArgs:= gctlZoomTarget.Value
End Function

4. In the Load event of the zoombox, copy the value from OpenArgs to the
big text box.

5. In the Click event of your Ok command button on your zoom form:
If Not gctlZoomTarget Is Nothing Then
gctlZoomTarget.Value = Me.[MyBigTextbox]
End If

That will certainly need refining and error handling, because the
ActiveControl might be a a command button or something which has no
Value.

You can then control it anyway you want, e.g. using SelStart and
SelLength to define what is initially selected, and setting the
EnterKeyBehavior of the ext box.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

SJ said:
Hi there,
when you press <SHIFT F2> the Zoom box appears with the text in the
current field.

Problem(s) for users is this,

1. The text is always highlighted, meaning a single keystroke can
over write all the data...

2. To create a new line in the Zoom Box, the user needs to press
<CTRL ENTER> instead of just ENTER...

I know it's a matter of training but that doesn't seem an option here.
you know how it is...

Does anyone know how to configure the Zoom Box to leave the cursor at
the end of the field, with the text NOT highlighted and to make it so
that a new line in the Zoom Box is created by ENTER only???

thx
 
A

Allen Browne

Thanks, Doug.
Macro Name is on the View menu
RunCode is the Action
=FireZoomBox() is the argument (lower pane of macro window.)

Your subsequent question is how to determine if the control is updatable.
The function below is untested, but should give you the idea.

The logic runs like this:
- If the control is locked or disabled, it is NOT updatable (from user
perspective.)
- If the control is unbound it IS updatable.
- If the control is bound to an expression it is NOT updatable.
- If none of those apply, its ControlSource must be a field, so we determine
its updatability from the DataUpdatable property of the field in the
RecordsetClone of the form.
- If the control is bound, but the form is not, this is an error situation,
so it is NOT updatable.
- If the control has no ControlSource (such as a label), it is NOT
updatable.
- For any other error, we return False (play safe.)

Examples of use
============
To test Text0 on Form1:
1. In code:
If IsControlUpdatable(Me, Me.Text0) Then ...

2. In the Condition column in a macro:
IsControlUpdatable([Forms]![Form1], [Forms]![Form1].[Text0])

----------------code begins----------------------
Function IsControlUpdatable(frm As Form, ctl As Control) As Boolean
On Error GoTo Err_Handler
'Purpose: Determine whether the control is updatable.
'Return: True if updatable, else False.
'Arguments: frm = the form the control is on.
' ctl = the control to examine.
Dim strControlSource As String
Dim bUpdatable As Boolean

'If Disabled or locked, not updatable.
If (ctl.Enabled) And Not (ctl.Locked) Then
strControlSource = Trim$(ctl.ControlSource)
If strControlSource = vbNullString Then
'Unbound: updatable.
bUpdatable = True
ElseIf strControlSource Like "=*" Then
'Bound to expression: not updatable.
ElseIf frm.RecordSource <> vbNullString Then
'Bound to field: read updatability from clone set.
bUpdatable =
frm.RecordsetClone.Fields(strControlSource).DataUpdatable
'Other case: form is unbound and control is bound: return false.
End If
End If

IsControlUpdatable = bUpdatable

Exit_Handler:
Exit Function

Err_Handler:
Select Case Err.Number
Case 438 'Object doesn't have a ControlSource.
Case Else
MsgBox "Error " & Err.Number & ": " & Err.Description, ,
"IsControlUpdatable()"
End Select
Resume Exit_Handler
End Function
----------------code ends----------------------

Hope that proves useful.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Douglas J. Steele said:
To get the MacroNames column added, check it on the View menu.

In step 2, select RunCode as the action, and put FireZoomBox() as the
function name.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


SJ said:
Hi Allan,
I couldn't quite understand points 2 and 3...

I allready have an AutoExec macro...

I couldn't find the "MacroNames" column.

The Action column ONLY lets me select from a set list...

I was wondering if you forgot to mention a step, therefore making me
quite lost...

sorry for the inconvenience...

oh yes, one other point, the ACCESS Zoom Box knows if a control is read
only, as I can't get this working, will it know, if I can get it
working then I can test that....


Allen Browne said:
I don't know any way to configure the zoom box, but it is not hard to
replace it with one you can configure.

This is untested and incomplete, but the basic idea:

1. Create a unbound form (no table), with a single large text box.

2. Create an AutoExec macro, and put this in the MacroNames column:
+{F2}
In the Action colunmn, enter your function name, such as:
=FireZoomBox()
Save the macro with the name AutoKeys. (The name is important.)

3. In a standard module, write the function to copy the text from the
active control to the big unbound text box, and keep track of the name
of the previous control:

Public gctlZoomTarget As Control
Function FireZoomBox()
gctlTarget = Screen.ActiveControl
DoCmd.OpenForm "frmZoom", WindowMode:=acDialog, _
OpenArgs:= gctlZoomTarget.Value
End Function

4. In the Load event of the zoombox, copy the value from OpenArgs to the
big text box.

5. In the Click event of your Ok command button on your zoom form:
If Not gctlZoomTarget Is Nothing Then
gctlZoomTarget.Value = Me.[MyBigTextbox]
End If

That will certainly need refining and error handling, because the
ActiveControl might be a a command button or something which has no
Value.

You can then control it anyway you want, e.g. using SelStart and
SelLength to define what is initially selected, and setting the
EnterKeyBehavior of the ext box.

Hi there,
when you press <SHIFT F2> the Zoom box appears with the text in the
current field.

Problem(s) for users is this,

1. The text is always highlighted, meaning a single keystroke can
over write all the data...

2. To create a new line in the Zoom Box, the user needs to press
<CTRL ENTER> instead of just ENTER...

I know it's a matter of training but that doesn't seem an option here.
you know how it is...

Does anyone know how to configure the Zoom Box to leave the cursor at
the end of the field, with the text NOT highlighted and to make it so
that a new line in the Zoom Box is created by ENTER only???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Zoom Box command button 4
Zoom box end of text 1
ability to open zoom box features 2
Zoom Box Font 2
Zoom form from Double-Click 2
Zoom Box Font - Change Permanently 4
Memo Zoom Box 1
zoom command 1

Top