PC Review


Reply
Thread Tools Rate Thread

Allow editing

 
 
Rolf Rosenquist
Guest
Posts: n/a
 
      14th Aug 2006
I have a form that is locked for editing already by opening the form. In the
code I use the line "Me.AllowEdits = Me.NewRecord" so that only new records
can be written.

Now I need to let the user be able to change one single field also on old
records. How can I let him do that? I have tried "Field.Locked = False" and
"Field.Enabled = True" but it does not help.

/ Rolf


 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      14th Aug 2006
If you set the form's AllowEdits property to Yes, you will not be able to
use any controls for editing, regardless of their Locked property.

You need to leave AllowEdits as No, and set the Locked property to No for
all the control other than the one the one you allow. Of course they have be
be set back to Yes for new records.

Use the code in this link:
Locking bound controls on a form and subforms
at:
http://allenbrowne.com/ser-56.html

The article explains how to call the code from a command button, but in your
case you will want to call it from the Current event of the form, like this:
Call LockBoundControls(Me, Not Me.NewRecord, "NameOfControlToNotLock")

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Rolf Rosenquist" <(E-Mail Removed)> wrote in message
news:u9zf%(E-Mail Removed)...
>I have a form that is locked for editing already by opening the form. In
>the
> code I use the line "Me.AllowEdits = Me.NewRecord" so that only new
> records
> can be written.
>
> Now I need to let the user be able to change one single field also on old
> records. How can I let him do that? I have tried "Field.Locked = False"
> and
> "Field.Enabled = True" but it does not help.



 
Reply With Quote
 
Rolf Rosenquist
Guest
Posts: n/a
 
      14th Aug 2006
Followed your example, but got an error for the code
"=LockBoundControls([Form],True)"
when I wrote it in the code at Private Sub Form_Load(). It says after
translation to English something like: "Compiling error: Expected: a row
number or a row label or a program statement or end of program statement."

Maybe I have tried to put it in the wrong place, but I could not find an On
Load property for the form. Should it be somewhere else?
/ Rolf





"Allen Browne" <(E-Mail Removed)> skrev i meddelandet
news:(E-Mail Removed)...
> If you set the form's AllowEdits property to Yes, you will not be able to
> use any controls for editing, regardless of their Locked property.
>
> You need to leave AllowEdits as No, and set the Locked property to No for
> all the control other than the one the one you allow. Of course they have

be
> be set back to Yes for new records.
>
> Use the code in this link:
> Locking bound controls on a form and subforms
> at:
> http://allenbrowne.com/ser-56.html
>
> The article explains how to call the code from a command button, but in

your
> case you will want to call it from the Current event of the form, like

this:
> Call LockBoundControls(Me, Not Me.NewRecord, "NameOfControlToNotLock")
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Rolf Rosenquist" <(E-Mail Removed)> wrote in message
> news:u9zf%(E-Mail Removed)...
> >I have a form that is locked for editing already by opening the form. In
> >the
> > code I use the line "Me.AllowEdits = Me.NewRecord" so that only new
> > records
> > can be written.
> >
> > Now I need to let the user be able to change one single field also on

old
> > records. How can I let him do that? I have tried "Field.Locked = False"
> > and
> > "Field.Enabled = True" but it does not help.

>
>



 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      14th Aug 2006
You can put it inside the event procedure code if you wish.
Use:
Call LockBoundControls(Me, True)

But I would have thought this would need to go into the form's Current event
rather than its Load event for your case, and the 2nd argument would be:
Not Me.NewRecord
rather than True, and you would need to pass the name of the control that
should be left unlocked as well.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Rolf Rosenquist" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Followed your example, but got an error for the code
> "=LockBoundControls([Form],True)"
> when I wrote it in the code at Private Sub Form_Load(). It says after
> translation to English something like: "Compiling error: Expected: a row
> number or a row label or a program statement or end of program statement."
>
> Maybe I have tried to put it in the wrong place, but I could not find an
> On
> Load property for the form. Should it be somewhere else?
> / Rolf
>
>
>
>
>
> "Allen Browne" <(E-Mail Removed)> skrev i meddelandet
> news:(E-Mail Removed)...
>> If you set the form's AllowEdits property to Yes, you will not be able to
>> use any controls for editing, regardless of their Locked property.
>>
>> You need to leave AllowEdits as No, and set the Locked property to No for
>> all the control other than the one the one you allow. Of course they have

> be
>> be set back to Yes for new records.
>>
>> Use the code in this link:
>> Locking bound controls on a form and subforms
>> at:
>> http://allenbrowne.com/ser-56.html
>>
>> The article explains how to call the code from a command button, but in

> your
>> case you will want to call it from the Current event of the form, like

> this:
>> Call LockBoundControls(Me, Not Me.NewRecord,
>> "NameOfControlToNotLock")
>>
>> "Rolf Rosenquist" <(E-Mail Removed)> wrote in message
>> news:u9zf%(E-Mail Removed)...
>> >I have a form that is locked for editing already by opening the form. In
>> >the
>> > code I use the line "Me.AllowEdits = Me.NewRecord" so that only new
>> > records
>> > can be written.
>> >
>> > Now I need to let the user be able to change one single field also on

> old
>> > records. How can I let him do that? I have tried "Field.Locked = False"
>> > and
>> > "Field.Enabled = True" but it does not help.



 
Reply With Quote
 
Rolf Rosenquist
Guest
Posts: n/a
 
      14th Aug 2006
Now most of it works as I wanted, but there is one little thing left. All
the controls work exactly as you say when I click the Unlock button. But
some of the fields, named A, B and C should not be able to edit. I tried to
put them as arguments, also as Not A..., but it did not work. Can that be
done?

/ Rolf


"Allen Browne" <(E-Mail Removed)> skrev i meddelandet
news:%(E-Mail Removed)...
> You can put it inside the event procedure code if you wish.
> Use:
> Call LockBoundControls(Me, True)
>
> But I would have thought this would need to go into the form's Current

event
> rather than its Load event for your case, and the 2nd argument would be:
> Not Me.NewRecord
> rather than True, and you would need to pass the name of the control that
> should be left unlocked as well.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Rolf Rosenquist" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Followed your example, but got an error for the code
> > "=LockBoundControls([Form],True)"
> > when I wrote it in the code at Private Sub Form_Load(). It says after
> > translation to English something like: "Compiling error: Expected: a row
> > number or a row label or a program statement or end of program

statement."
> >
> > Maybe I have tried to put it in the wrong place, but I could not find an
> > On
> > Load property for the form. Should it be somewhere else?
> > / Rolf
> >
> >
> >
> >
> >
> > "Allen Browne" <(E-Mail Removed)> skrev i meddelandet
> > news:(E-Mail Removed)...
> >> If you set the form's AllowEdits property to Yes, you will not be able

to
> >> use any controls for editing, regardless of their Locked property.
> >>
> >> You need to leave AllowEdits as No, and set the Locked property to No

for
> >> all the control other than the one the one you allow. Of course they

have
> > be
> >> be set back to Yes for new records.
> >>
> >> Use the code in this link:
> >> Locking bound controls on a form and subforms
> >> at:
> >> http://allenbrowne.com/ser-56.html
> >>
> >> The article explains how to call the code from a command button, but in

> > your
> >> case you will want to call it from the Current event of the form, like

> > this:
> >> Call LockBoundControls(Me, Not Me.NewRecord,
> >> "NameOfControlToNotLock")
> >>
> >> "Rolf Rosenquist" <(E-Mail Removed)> wrote in message
> >> news:u9zf%(E-Mail Removed)...
> >> >I have a form that is locked for editing already by opening the form.

In
> >> >the
> >> > code I use the line "Me.AllowEdits = Me.NewRecord" so that only new
> >> > records
> >> > can be written.
> >> >
> >> > Now I need to let the user be able to change one single field also on

> > old
> >> > records. How can I let him do that? I have tried "Field.Locked =

False"
> >> > and
> >> > "Field.Enabled = True" but it does not help.

>
>



 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      14th Aug 2006
Include the control names, in quotes and separated by commas, inside the
brackets, e.g.:

Call LockBoundControls(Me, Not Me.NewRecord, "A", "B", "C")

You can list as many as you need.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Rolf Rosenquist" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Now most of it works as I wanted, but there is one little thing left. All
> the controls work exactly as you say when I click the Unlock button. But
> some of the fields, named A, B and C should not be able to edit. I tried
> to
> put them as arguments, also as Not A..., but it did not work. Can that be
> done?
>
> / Rolf
>
>
> "Allen Browne" <(E-Mail Removed)> skrev i meddelandet
> news:%(E-Mail Removed)...
>> You can put it inside the event procedure code if you wish.
>> Use:
>> Call LockBoundControls(Me, True)
>>
>> But I would have thought this would need to go into the form's Current

> event
>> rather than its Load event for your case, and the 2nd argument would be:
>> Not Me.NewRecord
>> rather than True, and you would need to pass the name of the control that
>> should be left unlocked as well.
>>
>> "Rolf Rosenquist" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > Followed your example, but got an error for the code
>> > "=LockBoundControls([Form],True)"
>> > when I wrote it in the code at Private Sub Form_Load(). It says after
>> > translation to English something like: "Compiling error: Expected: a
>> > row
>> > number or a row label or a program statement or end of program

> statement."
>> >
>> > Maybe I have tried to put it in the wrong place, but I could not find
>> > an
>> > On
>> > Load property for the form. Should it be somewhere else?
>> > / Rolf
>> >
>> > "Allen Browne" <(E-Mail Removed)> skrev i meddelandet
>> > news:(E-Mail Removed)...
>> >> If you set the form's AllowEdits property to Yes, you will not be able

> to
>> >> use any controls for editing, regardless of their Locked property.
>> >>
>> >> You need to leave AllowEdits as No, and set the Locked property to No

> for
>> >> all the control other than the one the one you allow. Of course they

> have
>> > be
>> >> be set back to Yes for new records.
>> >>
>> >> Use the code in this link:
>> >> Locking bound controls on a form and subforms
>> >> at:
>> >> http://allenbrowne.com/ser-56.html
>> >>
>> >> The article explains how to call the code from a command button, but
>> >> in
>> > your
>> >> case you will want to call it from the Current event of the form, like
>> > this:
>> >> Call LockBoundControls(Me, Not Me.NewRecord,
>> >> "NameOfControlToNotLock")
>> >>
>> >> "Rolf Rosenquist" <(E-Mail Removed)> wrote in message
>> >> news:u9zf%(E-Mail Removed)...
>> >> >I have a form that is locked for editing already by opening the form.

> In
>> >> >the
>> >> > code I use the line "Me.AllowEdits = Me.NewRecord" so that only new
>> >> > records
>> >> > can be written.
>> >> >
>> >> > Now I need to let the user be able to change one single field also
>> >> > on
>> > old
>> >> > records. How can I let him do that? I have tried "Field.Locked =

> False"
>> >> > and
>> >> > "Field.Enabled = True" but it does not help.



 
Reply With Quote
 
Rolf Rosenquist
Guest
Posts: n/a
 
      14th Aug 2006
Yes I thought so, and that was exactly what I did, but it doesn't work. This
line is copied from the code.
Call LockBoundControls(Me, Not Me.NewRecord, "utA"), but I cannot have
the"utA" to stay locked.
/ Rolf




"Allen Browne" <(E-Mail Removed)> skrev i meddelandet
news:%(E-Mail Removed)...
> Include the control names, in quotes and separated by commas, inside the
> brackets, e.g.:
>
> Call LockBoundControls(Me, Not Me.NewRecord, "A", "B", "C")
>
> You can list as many as you need.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Rolf Rosenquist" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Now most of it works as I wanted, but there is one little thing left.

All
> > the controls work exactly as you say when I click the Unlock button. But
> > some of the fields, named A, B and C should not be able to edit. I tried
> > to
> > put them as arguments, also as Not A..., but it did not work. Can that

be
> > done?
> >
> > / Rolf
> >
> >
> > "Allen Browne" <(E-Mail Removed)> skrev i meddelandet
> > news:%(E-Mail Removed)...
> >> You can put it inside the event procedure code if you wish.
> >> Use:
> >> Call LockBoundControls(Me, True)
> >>
> >> But I would have thought this would need to go into the form's Current

> > event
> >> rather than its Load event for your case, and the 2nd argument would

be:
> >> Not Me.NewRecord
> >> rather than True, and you would need to pass the name of the control

that
> >> should be left unlocked as well.
> >>
> >> "Rolf Rosenquist" <(E-Mail Removed)> wrote in message
> >> news:(E-Mail Removed)...
> >> > Followed your example, but got an error for the code
> >> > "=LockBoundControls([Form],True)"
> >> > when I wrote it in the code at Private Sub Form_Load(). It says after
> >> > translation to English something like: "Compiling error: Expected: a
> >> > row
> >> > number or a row label or a program statement or end of program

> > statement."
> >> >
> >> > Maybe I have tried to put it in the wrong place, but I could not find
> >> > an
> >> > On
> >> > Load property for the form. Should it be somewhere else?
> >> > / Rolf
> >> >
> >> > "Allen Browne" <(E-Mail Removed)> skrev i meddelandet
> >> > news:(E-Mail Removed)...
> >> >> If you set the form's AllowEdits property to Yes, you will not be

able
> > to
> >> >> use any controls for editing, regardless of their Locked property.
> >> >>
> >> >> You need to leave AllowEdits as No, and set the Locked property to

No
> > for
> >> >> all the control other than the one the one you allow. Of course they

> > have
> >> > be
> >> >> be set back to Yes for new records.
> >> >>
> >> >> Use the code in this link:
> >> >> Locking bound controls on a form and subforms
> >> >> at:
> >> >> http://allenbrowne.com/ser-56.html
> >> >>
> >> >> The article explains how to call the code from a command button, but
> >> >> in
> >> > your
> >> >> case you will want to call it from the Current event of the form,

like
> >> > this:
> >> >> Call LockBoundControls(Me, Not Me.NewRecord,
> >> >> "NameOfControlToNotLock")
> >> >>
> >> >> "Rolf Rosenquist" <(E-Mail Removed)> wrote in message
> >> >> news:u9zf%(E-Mail Removed)...
> >> >> >I have a form that is locked for editing already by opening the

form.
> > In
> >> >> >the
> >> >> > code I use the line "Me.AllowEdits = Me.NewRecord" so that only

new
> >> >> > records
> >> >> > can be written.
> >> >> >
> >> >> > Now I need to let the user be able to change one single field also
> >> >> > on
> >> > old
> >> >> > records. How can I let him do that? I have tried "Field.Locked =

> > False"
> >> >> > and
> >> >> > "Field.Enabled = True" but it does not help.

>
>



 
Reply With Quote
 
Rolf Rosenquist
Guest
Posts: n/a
 
      14th Aug 2006
With help of your earlier inputs, I came up with another idea to do it. Not
elegant, but I did lock all the normal fields A, B, C...except the one that
should be editable when inside an old record and made the opposite when in a
new record.

Thanks for helping me with ideas. Regards

/ Rolf


"Allen Browne" <(E-Mail Removed)> skrev i meddelandet
news:%(E-Mail Removed)...
> Include the control names, in quotes and separated by commas, inside the
> brackets, e.g.:
>
> Call LockBoundControls(Me, Not Me.NewRecord, "A", "B", "C")
>
> You can list as many as you need.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Rolf Rosenquist" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Now most of it works as I wanted, but there is one little thing left.

All
> > the controls work exactly as you say when I click the Unlock button. But
> > some of the fields, named A, B and C should not be able to edit. I tried
> > to
> > put them as arguments, also as Not A..., but it did not work. Can that

be
> > done?
> >
> > / Rolf
> >
> >
> > "Allen Browne" <(E-Mail Removed)> skrev i meddelandet
> > news:%(E-Mail Removed)...
> >> You can put it inside the event procedure code if you wish.
> >> Use:
> >> Call LockBoundControls(Me, True)
> >>
> >> But I would have thought this would need to go into the form's Current

> > event
> >> rather than its Load event for your case, and the 2nd argument would

be:
> >> Not Me.NewRecord
> >> rather than True, and you would need to pass the name of the control

that
> >> should be left unlocked as well.
> >>
> >> "Rolf Rosenquist" <(E-Mail Removed)> wrote in message
> >> news:(E-Mail Removed)...
> >> > Followed your example, but got an error for the code
> >> > "=LockBoundControls([Form],True)"
> >> > when I wrote it in the code at Private Sub Form_Load(). It says after
> >> > translation to English something like: "Compiling error: Expected: a
> >> > row
> >> > number or a row label or a program statement or end of program

> > statement."
> >> >
> >> > Maybe I have tried to put it in the wrong place, but I could not find
> >> > an
> >> > On
> >> > Load property for the form. Should it be somewhere else?
> >> > / Rolf
> >> >
> >> > "Allen Browne" <(E-Mail Removed)> skrev i meddelandet
> >> > news:(E-Mail Removed)...
> >> >> If you set the form's AllowEdits property to Yes, you will not be

able
> > to
> >> >> use any controls for editing, regardless of their Locked property.
> >> >>
> >> >> You need to leave AllowEdits as No, and set the Locked property to

No
> > for
> >> >> all the control other than the one the one you allow. Of course they

> > have
> >> > be
> >> >> be set back to Yes for new records.
> >> >>
> >> >> Use the code in this link:
> >> >> Locking bound controls on a form and subforms
> >> >> at:
> >> >> http://allenbrowne.com/ser-56.html
> >> >>
> >> >> The article explains how to call the code from a command button, but
> >> >> in
> >> > your
> >> >> case you will want to call it from the Current event of the form,

like
> >> > this:
> >> >> Call LockBoundControls(Me, Not Me.NewRecord,
> >> >> "NameOfControlToNotLock")
> >> >>
> >> >> "Rolf Rosenquist" <(E-Mail Removed)> wrote in message
> >> >> news:u9zf%(E-Mail Removed)...
> >> >> >I have a form that is locked for editing already by opening the

form.
> > In
> >> >> >the
> >> >> > code I use the line "Me.AllowEdits = Me.NewRecord" so that only

new
> >> >> > records
> >> >> > can be written.
> >> >> >
> >> >> > Now I need to let the user be able to change one single field also
> >> >> > on
> >> > old
> >> >> > records. How can I let him do that? I have tried "Field.Locked =

> > False"
> >> >> > and
> >> >> > "Field.Enabled = True" but it does not help.

>
>



 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      15th Aug 2006
Yes, that's the idea. You set the Locked state for these controls the way
you want them, and the code ignores them when you add their name to the
exception list.

All the best

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Rolf Rosenquist" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> With help of your earlier inputs, I came up with another idea to do it.
> Not
> elegant, but I did lock all the normal fields A, B, C...except the one
> that
> should be editable when inside an old record and made the opposite when in
> a
> new record.
>
> Thanks for helping me with ideas. Regards
>
> / Rolf
>
>
> "Allen Browne" <(E-Mail Removed)> skrev i meddelandet
> news:%(E-Mail Removed)...
>> Include the control names, in quotes and separated by commas, inside the
>> brackets, e.g.:
>>
>> Call LockBoundControls(Me, Not Me.NewRecord, "A", "B", "C")
>>
>> You can list as many as you need.
>>
>> "Rolf Rosenquist" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > Now most of it works as I wanted, but there is one little thing left.

> All
>> > the controls work exactly as you say when I click the Unlock button.
>> > But
>> > some of the fields, named A, B and C should not be able to edit. I
>> > tried
>> > to
>> > put them as arguments, also as Not A..., but it did not work. Can that

> be
>> > done?
>> >
>> > / Rolf
>> >
>> >
>> > "Allen Browne" <(E-Mail Removed)> skrev i meddelandet
>> > news:%(E-Mail Removed)...
>> >> You can put it inside the event procedure code if you wish.
>> >> Use:
>> >> Call LockBoundControls(Me, True)
>> >>
>> >> But I would have thought this would need to go into the form's Current
>> > event
>> >> rather than its Load event for your case, and the 2nd argument would

> be:
>> >> Not Me.NewRecord
>> >> rather than True, and you would need to pass the name of the control

> that
>> >> should be left unlocked as well.



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
1 person editing while another views the editing Ray Brown Microsoft Word Document Management 2 12th Feb 2009 01:57 PM
editing converted pdf to word doc for text editing gfw Microsoft Word Document Management 2 8th Jun 2008 06:05 AM
podcasting editing freeware AND/OR RSS editing freeware juanisito Freeware 1 12th May 2005 04:21 PM
DVD Editing =?Utf-8?B?TWF0dA==?= Windows XP MovieMaker 4 28th Jun 2004 03:19 PM
Editing Live vs. Editing Local and Publishing Mike Microsoft Frontpage 2 21st Jul 2003 05:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:04 AM.