Solved

Access Combo Box - force the user to enter a value

Posted on 2009-07-07
2
335 Views
Last Modified: 2012-05-07
Hi,

I have a form with a combo box, I want to force the user to enter a value into this Field

e.g.

Combo Box(or a drop down menu)  called "Currency" has a list choice of "GBP" or "Eur"

I have the default value set to "Select Currency"

I have the properties "Limit to List" option set to "yes" So the field should only save with values of "GBP" or "EUR"

If you tab past the combo box, Access save the record with the default value ("Select Currency"), however the validation does work if you click on the field and type something other than the values in the list.

How can I get Access to look at the combo box even if the user tabs over this field and tries to save the record?

Thanks for your help.

0
Comment
Question by:squidlings
[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
2 Comments
 
LVL 6

Accepted Solution

by:
Yadtrt earned 500 total points
ID: 24792857
Use form before update event
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.comoboxName = "Select Currency" Then
Cancel = True
MsgBox " You should Select a Currency"
End If
End Sub

Open in new window

0
 

Author Closing Comment

by:squidlings
ID: 31600534
Thanks, purrrfect.

I was putting code under the combo box not the form itself, still my code probably wasn't working anyway... Big help!  Cheers, Rich
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

732 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