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 / General 2 / June 2007

Tip: Looking for answers? Try searching our database.

Prevent change to field based on value selected in drop down

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Patricia - 14 Jun 2007 13:03 GMT
I have a form that has a field that is a drop down with 5 values in it.  Is
it possible to lock the field from update if they select one of the values,
but leave it open for update if they select the other 4?  
Ex:
Values: Plan, Hold, Request, In process, Cancel

If Request is selected I do not want the users to be able to change the
status, but if they select Plan - then it is ok to have the user change the
status
Al Campagna - 14 Jun 2007 15:17 GMT
Patricia,
   Use the AfterUpdate event of the combo to lock the field.
Private Sub YourComboName_AfterUpdate()
   If YourComboName = "Request" Then
       YourComboName.Locked = True
       YourComboName.Enabled = False
   Else
       YourComboName.Locked = False
       YourComboName.Enabled = True
   End If

   You'll also have to place this same code on the OnCurrent event of the
form itself... so that whenever you browse to a "Request" record, the field
will be Locked.
------
HTH
Al Campagna
Access MVP 2007
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love, and you'll never work a day in your life."
>I have a form that has a field that is a drop down with 5 values in it.  Is
> it possible to lock the field from update if they select one of the
[quoted text clipped - 7 lines]
> the
> status
Sprinks - 14 Jun 2007 15:21 GMT
Patricia,

In the AfterUpdate event of the combo box and the form's OnCurrent event:

If Me![YourComboBox] = "Request" Then
    Me![YourComboBox].Locked = True
End If

Note that, depending on your RowSource and ColumnWidths properties, the
combo box may *display* something different from its value.  If you're unsure
what the value is corresponding to "Request", insert a temporary MsgBox
statement in the procedure:

MsgBox Me![YourComboBox]

then edit the If statement as required.

Sprinks

> I have a form that has a field that is a drop down with 5 values in it.  Is
> it possible to lock the field from update if they select one of the values,
[quoted text clipped - 5 lines]
> status, but if they select Plan - then it is ok to have the user change the
> status
 
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.