Changed from ZoomBox to form, now won't unlock

  • Thread starter Thread starter Helen
  • Start date Start date
H

Helen

Hello everyone!

I have a form "frmAgentsNotes". Created a command button
to open the form as a read only.


Private Sub Form_Open(Cancel As Integer)

Me.Notes.Locked = True

End Sub


I have a second command that opens the form to edit mode.
Here is part of the code.

When I used the cmdZoomBox it worked ok. So I substituted
my form "frmAgentsNotes" instead of cmdZoomBox and it
stays locked. What am I missing?



If Nz(Me.tbPWord, "") = strPW Then
' Code to un-protect the notes field - I've
assumed Locked
Me.Notes.Locked = False
'Open MyZoomBox
DoCmd.OpenForm "frmAgentsNotes",
acNormal, , , , acDialog
If Me.Dirty Then Me.Dirty = False
Me.Notes.Locked = True
Else
 
Hi Helen

Andy here. Did you enjoy Las Vegas?

The reason why your code won't work is that when you open the form
'frmAgentsNotes' the Notes field is locked by the Form's On Open event.
Instead of setting the Locked property in the OnOpen event, I would suggest
you use the datamode parameter of the OpenForm method;

ReadOnly mode:

DoCmd.OpenForm "frmAgentsNotes", acNormal, , , acFormReadOnly, acDialog

Edit Mode:

DoCmd.OpenForm "frmAgentsNotes", acNormal, , , acFormEdit, acDialog

HTH

Andy
 
Andy,
That works ok.

But, (like always)

on frmUNamePWord, when I click on a "Notes" field that
doesn't have a password, it opens up the first record for
editing instead of opening up the note record I clicked
on. How can I change that?

Helen.
 
Hey Helen

Really bad news about the accident - I send my wishes for a speedy recovery.

Can you receive attachments at your posting address? if so let me know and
I'll send you a small demo DB I did while you were supposed to be relaxing
that does everything you want + the changing of Password routine I promised

Andy
 
I can receive, but can't send.

send to: (e-mail address removed)

Thank you Andy, and thanks for the wishes . .

Helen
 
Back
Top