[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How to take a combo box on Access Form so user can't type in the box?

Posted on 2011-03-24
6
Medium Priority
?
285 Views
Last Modified: 2012-05-11
Hello,

I have a form with a combo box on it and a user can type things or even remove the selections and save values that are not listed in the combo. How can I have the combo box act more like a drop down list box, so the user can't type in values that are not in the list?
0
Comment
Question by:gtrapp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 8

Expert Comment

by:pdd1lan
ID: 35211794
try DropDownStyle property to DropDownList
0
 
LVL 75
ID: 35211796
Set the Limit To List property to Yes.

mx
Capture1.gif
0
 

Author Comment

by:gtrapp
ID: 35211837
I have Limit To List property to Yes, but I am able to clear out the selected value and save a blank to the record. Only want users to select a value in the list and save that value.

Where is the DropDownList property set?

I am using Access 2007 and have 3 values to select from in the combo box.
0
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 35211873
Limit To List should do this.  Something else is going on then.  However, Limit To List does not prevent a  user from backing out an existing entry, then saving a 'blank' (Null) value.  To prevent that, you need to make that field required in your table or do validation at the Form level ... that the value is present and Not Null.

mx
0
 
LVL 26

Expert Comment

by:Nick67
ID: 35211953
As @DatabaseMX said, Limit to List should prevent silliness.  In your image, you don't show where the box is getting its data from.
That may be why Limit to List isn't working.  It is hard to limit it to a non-existent list.

Limit to List makes the NotInList event fire when an attempt to add something new occurs.
Validating can get done in there too
Private Sub Combo0_NotInList(NewData As String, response As Integer)
    Select case true
        case NewData = "Some value I like 1"
            response = acDataErrAdded
        case NewData = "Some value I like 2"
            response = acDataErrAdded
        case NewData = "Some value I like 3"
            response = acDataErrAdded
        case Else
            Msgbox "That response was NFG, try again!"
            response = acDataErrContinue
    End Select 
End Sub

Open in new window

0
 
LVL 75
ID: 35212110
Nick >> "and have 3 values to select from in the combo box."

"Validating can get done in there too"
The Not In List is not for validating data per se.  It's to allow the user to capture the fact, and present a user friendly message and/or add the item to the List.

mx
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question