allow edits to one field on "allow addition form"

  • Thread starter cableguy47905 via AccessMonster.com
  • Start date
C

cableguy47905 via AccessMonster.com

I have read the previous entries for this subject and I think one is very
close, but I am not sure if all of it applies.

I have an addition only form that I want to use to be able to "goto" specific
records that show up in my combo box. I have got that to work, if I allow
edits on the form, but I do not want everyone to be able to edit this form.
They can add and view records only. I can't update the combo box unless the
allow edits is on.

I was wondering if the lock/unlock method would work in this situation? If
so, would I still have it set to allow additions only, or not?

Any help will be appreciated.

Lee
 
M

Marshall Barton

cableguy47905 said:
I have read the previous entries for this subject and I think one is very
close, but I am not sure if all of it applies.

I have an addition only form that I want to use to be able to "goto" specific
records that show up in my combo box. I have got that to work, if I allow
edits on the form, but I do not want everyone to be able to edit this form.
They can add and view records only. I can't update the combo box unless the
allow edits is on.

I was wondering if the lock/unlock method would work in this situation? If
so, would I still have it set to allow additions only, or not?


Assuming you have some way of determining who should be
allowed to edit existing records, you can use the AllowEdits
property. Note that this also prohibits entering data in
any unbound controls that you are using for searching, etc.
Since you want to use the combo box for navigating to
records, you need to use the Locked property on the bound
controls.

I generally recommend setting the Tag property of the
controls you want to lock/unlock to something such as LOCK.
Then create a Sub procedure like:

Public Sub SetLocks(frm As Form, OnOff As Boolean)
Dim ctl As Control
For Each ctl In frm.Controls
If ctl.Tag = "LOCK" Then ctl.Locked = OnOff
Next ctl
End Sub

Then when you want to unlock the record's controls, just
call the procedure:
SetLocks Me, False
 
C

cableguy47905 via AccessMonster.com

Assuming you have some way of determining who should be
allowed to edit existing records, you can use the AllowEdits
property. Note that this also prohibits entering data in
any unbound controls that you are using for searching, etc.
Since you want to use the combo box for navigating to
records, you need to use the Locked property on the bound
controls.

I generally recommend setting the Tag property of the
controls you want to lock/unlock to something such as LOCK.
Then create a Sub procedure like:

Public Sub SetLocks(frm As Form, OnOff As Boolean)
Dim ctl As Control
For Each ctl In frm.Controls
If ctl.Tag = "LOCK" Then ctl.Locked = OnOff
Next ctl
End Sub

Then when you want to unlock the record's controls, just
call the procedure:
SetLocks Me, False


Thanks, I was using the form fine with the allow.edits = false. now that I
want to navigate with the combo box, it won't work, as you said. I want this
form to only allow additions, not edits except for that one unbound combo box.

If I set the allow.edits = true, and I lock all of the bound controls, this
works fine, except for when I want to do an addition. Won't this prevent me
from adding any new records until I unlock all of the bound controls?
If that is the case, where would I put the code so that the bound controls
are all unlocked for a new record, but locked for all existing records?

Thanks,
Lee
 
M

Marshall Barton

cableguy47905 said:
Thanks, I was using the form fine with the allow.edits = false. now that I
want to navigate with the combo box, it won't work, as you said. I want this
form to only allow additions, not edits except for that one unbound combo box.

If I set the allow.edits = true, and I lock all of the bound controls, this
works fine, except for when I want to do an addition. Won't this prevent me
from adding any new records until I unlock all of the bound controls?
If that is the case, where would I put the code so that the bound controls
are all unlocked for a new record, but locked for all existing records?


Use the form's Current event:

SetLocks(Me, Not Me.NewRecord)
 

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