J
Julia Boswell
Folks,
I have, what I'm sure is a really simple to fix problem, but it's driving me
nuts and I'm sure I'll kick myself when I realise what the problem is!
I have a form set up as a menu that has two commands cmdEdit and cmdRead.
cmdEdit opens form "frmAnticipated" with the controls unlocked and cmdRead
opens form "frmAnticipated" with most of the controls (but not all) locked.
For user benefit I've got labels on frmAnticipated to identify which mode
the form is in i.e. Read only or Edit mode. So the other thing cmdEdit and
cmdRead do is to set the value on a hidden field on frmAnticipated called
txtMode to either "EditMode" or "ReadOnly" respectively.
This all works fine, except when I try and reset the labels on
frmAnticipated based on the value in txtMode. My code on frmAnticipated goes
like this:
If Me.txtMode.Value = "EditMode" Then
Me.lblFormStatus.Caption = "This form is in edit mode"
Me.cmdSaveClose.Caption = "Save and Close"
Me.cmdUndoClose.Visible = True
Else
Me.lblFormStatus.Caption = "This form is in read only mode"
Me.cmdSaveClose.Caption = "Close"
Me.cmdUndoClose.Visible = False
End If
I've tried this code on the OnOpen, OnActivate and OnCurrent events and the
value is not recognised. I know it's something to do with order of events as
I tried to display the value in txtMode through a message box and I get the
message "Invalid Use of Null", however when the form finally does open and
if I make txtMode visible it has been set to the appropriate value.
When should I run this code?
Thanks in advance.
Julia
I have, what I'm sure is a really simple to fix problem, but it's driving me
nuts and I'm sure I'll kick myself when I realise what the problem is!
I have a form set up as a menu that has two commands cmdEdit and cmdRead.
cmdEdit opens form "frmAnticipated" with the controls unlocked and cmdRead
opens form "frmAnticipated" with most of the controls (but not all) locked.
For user benefit I've got labels on frmAnticipated to identify which mode
the form is in i.e. Read only or Edit mode. So the other thing cmdEdit and
cmdRead do is to set the value on a hidden field on frmAnticipated called
txtMode to either "EditMode" or "ReadOnly" respectively.
This all works fine, except when I try and reset the labels on
frmAnticipated based on the value in txtMode. My code on frmAnticipated goes
like this:
If Me.txtMode.Value = "EditMode" Then
Me.lblFormStatus.Caption = "This form is in edit mode"
Me.cmdSaveClose.Caption = "Save and Close"
Me.cmdUndoClose.Visible = True
Else
Me.lblFormStatus.Caption = "This form is in read only mode"
Me.cmdSaveClose.Caption = "Close"
Me.cmdUndoClose.Visible = False
End If
I've tried this code on the OnOpen, OnActivate and OnCurrent events and the
value is not recognised. I know it's something to do with order of events as
I tried to display the value in txtMode through a message box and I get the
message "Invalid Use of Null", however when the form finally does open and
if I make txtMode visible it has been set to the appropriate value.
When should I run this code?
Thanks in advance.
Julia