Edit Records

A

alex

I have a combo box on a form used to lookup records.

It seems that in order for this combo box to work, I must set Allow
Edits to Yes, making the entire form (minus locked records) editable.

I only want records to be editable, however, if the user presses a
command button. I tried some VBA coding to modify the RecordsetType
upon a click of an 'edit button.' This, however, didn't work well and
I figured there's a simpler way.

Thoughts?

1. Allow a combo box to function on a form without the ability to edit/
change a record.
2. create a command control to set allow edits to yes upon click.
3. I'm assuming you would then add code to the AfterUpdate and
OnCurrent events setting allow edits to no.

alex
 
A

Allen Browne

Yes, if you set the form's AllowEdits to No, you can't even use the unbound
controls.

So, you need to set the Locked property of the controls instead of the
AllowEdits of the form. The code to do that is in this article:
Locking bound controls on a form and subforms
at:
http://allenbrowne.com/ser-56.html

The code toggles the Locked property of all controls on your form that are
bound to fields, leaving the unbound controls usable. You can specify
exceptions if there are some controls you don't want locked/unlocked. The
code also loops through any subforms it finds recursively to any depth.
 
A

alex

Yes, if you set the form's AllowEdits to No, you can't even use the unbound
controls.

So, you need to set the Locked property of the controls instead of the
AllowEdits of the form. The code to do that is in this article:
Locking bound controls on a form and subforms
at:
http://allenbrowne.com/ser-56.html

The code toggles the Locked property of all controls on your form that are
bound to fields, leaving the unbound controls usable. You can specify
exceptions if there are some controls you don't want locked/unlocked. The
code also loops through any subforms it finds recursively to any depth.

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









- Show quoted text -

Thanks Allen; i'll give it a try.

alex
 

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

Top