Changed from ZoomBox to form, now won't unlock

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
 
A

Andy Cole

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
 
H

Helen

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.
 
A

Andy Cole

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
 
H

Helen

I can receive, but can't send.

send to: (e-mail address removed)

Thank you Andy, and thanks for the wishes . .

Helen
 

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


Top