lock field

  • Thread starter Thread starter Bill H.
  • Start date Start date
B

Bill H.

I have a subform set to Continuous Form, and a combo box on that subform for
selecting records to add to the table. After a selection has been made from
the combo box, I want to lock the combo box so no change can be made. Yet, I
still want to be able to add new records.

What's the best way to set that up?

Thanks.
 
Hm.

I don't think that will work since the records in the combo box will always
be in the list and if they are not in the list, I don't want them added to
the table of the parent form.

Make sense?

Arvin Meyer said:
The combobox needs to be unbound from the subform's recordsource, (but bound
to its own rowsource). Use the NotInList event to add new records. Try this
KB article:

Use NotInList Event to Add a Record to Combo Box
http://support.microsoft.com/kb/197526/en-us

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

in message
 
try putting the following code in form's Current event procedure, as

Me!ComboboxName.Locked = Not Me.NewRecord

replace ComboboxName with the correct name of the combobox control, of
course. alternately, you can use the following code in the combobox
control's Enter event procedure, to prevent changes once data has been
entered, as

Me!ComboboxName.Locked = Not IsNull(Me!ComboboxName)

that's a very harsh environment for a user to work in, though, because it
doesn't allow for a data entry error at all. simply locking the control
after a new record is saved and the user moves on, is much more forgiving of
human error - though you may want to consider a contingency for the user who
doesn't notice a data entry error until after exiting a new record; that
will undoubtedly happen from time to time.

hth
 
I must have read your post incorrectly. It looked like you wanted to be able
to add new records to the combo. If you don't, simply don't use the
NotInList event to add them.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Bill H. said:
Hm.

I don't think that will work since the records in the combo box will
always
be in the list and if they are not in the list, I don't want them added to
the table of the parent form.

Make sense?
 
In this case, the corrective procedure for the user is to delete the bad
entry.

:-)

But actually, I ended up using the form's Allow Edits property and setting
to No.

Thanks.

in message
try putting the following code in form's Current event procedure, as

Me!ComboboxName.Locked = Not Me.NewRecord

replace ComboboxName with the correct name of the combobox control, of
course. alternately, you can use the following code in the combobox
control's Enter event procedure, to prevent changes once data has been
entered, as

Me!ComboboxName.Locked = Not IsNull(Me!ComboboxName)

that's a very harsh environment for a user to work in, though, because it
doesn't allow for a data entry error at all. simply locking the control
after a new record is saved and the user moves on, is much more forgiving of
human error - though you may want to consider a contingency for the user who
doesn't notice a data entry error until after exiting a new record; that
will undoubtedly happen from time to time.

hth


"Bill H." wrote in message
I have a subform set to Continuous Form, and a combo box on that subform for
selecting records to add to the table. After a selection has been made from
the combo box, I want to lock the combo box so no change can be made.
Yet,
 
Back
Top