Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

lock field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill H. - 05 Nov 2006 07:58 GMT
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.

Signature

Bill

Arvin Meyer [MVP] - 05 Nov 2006 16:28 GMT
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

Signature

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

>I have a subform set to Continuous Form, and a combo box on that subform
>for
[quoted text clipped - 7 lines]
>
> Thanks.
Bill H. - 05 Nov 2006 19:04 GMT
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?

> 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
[quoted text clipped - 14 lines]
> >
> > Thanks.
Arvin Meyer [MVP] - 06 Nov 2006 04:18 GMT
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.
Signature

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

> Hm.
>
[quoted text clipped - 26 lines]
>> >
>> > Thanks.
tina - 05 Nov 2006 22:09 GMT
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 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
[quoted text clipped - 4 lines]
>
> Thanks.
Bill H. - 18 Nov 2006 06:37 GMT
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.

> try putting the following code in form's Current event procedure, as
>
[quoted text clipped - 27 lines]
> >
> > Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.