B
Bonno
Dear friends,
I have a problem with a form that looses its maximised property after using
a dialog screen. I am using Access 2003 ADP and SQL Server 2000.
The situation is as follows: I have a form called Tasks that is updatable
for current records and readonly for history records. In order to switch
between the two modes I use a dialog form that includes fields for record
selection and a yes/no box for history selection.
Depending on the setting of the history flag I open the form Tasks without a
datamode or with datamode=acFormReadOnly. The beauty of this method is that
all subforms are also opened as readonly without any additional coding.
The problem arises when the form is allready opened when I use the dialog
form. So if the form is updatable and I use DoCmd.OpenForm "Tasks", , , ,
acFormReadOnly, the form stays updatable. The other way around has the same
effect, if the form is readonly and I use DoCmd.OpenForm "Tasks" the form
stays readonly. In order to make the form switch its datamode, it is
necessary to close the form first. But when doing so, the form looses its
maximised property, which confuses the user, causes flicker on the screen
and in general does not look right.
I am using the following code:
If History Then
If Forms!Tasks.AllowEdits Then 'switch from updatable to
readonly
DoCmd.Close acForm, "Tasks"
DoCmd.OpenForm "Tasks", , , , acFormReadOnly
End If
Else
If Not Forms!Tasks.AllowEdits Then 'switch from readonly to
updatable
DoCmd.Close acForm, "Tasks"
DoCmd.OpenForm "Tasks"
End If
End If
If the dialog form isn't opened as a dialog but as a normal form, the forms
stay maximised. It is the DoCmd.Close acForm, "Tasks" that causes the
problem.
I have two questions about the subject:
1. Is there a better way to apply the acFormReadOnly property to the form
without closing it first?
2. How can I prevent that the dialog form makes the form Tasks loose its
maximised property?
I know there are two other ways to make a form readonly like
RecordsetType=Snapshot and AllowEdits=False.
The first method gives me (intermittent) error 2455 on one of the subforms
and method two needs too many lines of code if you have many subforms.
Any suggestions are greatly welcomed,
Bonno Hylkema
I have a problem with a form that looses its maximised property after using
a dialog screen. I am using Access 2003 ADP and SQL Server 2000.
The situation is as follows: I have a form called Tasks that is updatable
for current records and readonly for history records. In order to switch
between the two modes I use a dialog form that includes fields for record
selection and a yes/no box for history selection.
Depending on the setting of the history flag I open the form Tasks without a
datamode or with datamode=acFormReadOnly. The beauty of this method is that
all subforms are also opened as readonly without any additional coding.
The problem arises when the form is allready opened when I use the dialog
form. So if the form is updatable and I use DoCmd.OpenForm "Tasks", , , ,
acFormReadOnly, the form stays updatable. The other way around has the same
effect, if the form is readonly and I use DoCmd.OpenForm "Tasks" the form
stays readonly. In order to make the form switch its datamode, it is
necessary to close the form first. But when doing so, the form looses its
maximised property, which confuses the user, causes flicker on the screen
and in general does not look right.
I am using the following code:
If History Then
If Forms!Tasks.AllowEdits Then 'switch from updatable to
readonly
DoCmd.Close acForm, "Tasks"
DoCmd.OpenForm "Tasks", , , , acFormReadOnly
End If
Else
If Not Forms!Tasks.AllowEdits Then 'switch from readonly to
updatable
DoCmd.Close acForm, "Tasks"
DoCmd.OpenForm "Tasks"
End If
End If
If the dialog form isn't opened as a dialog but as a normal form, the forms
stay maximised. It is the DoCmd.Close acForm, "Tasks" that causes the
problem.
I have two questions about the subject:
1. Is there a better way to apply the acFormReadOnly property to the form
without closing it first?
2. How can I prevent that the dialog form makes the form Tasks loose its
maximised property?
I know there are two other ways to make a form readonly like
RecordsetType=Snapshot and AllowEdits=False.
The first method gives me (intermittent) error 2455 on one of the subforms
and method two needs too many lines of code if you have many subforms.
Any suggestions are greatly welcomed,
Bonno Hylkema