Solved

Access Combo Box - force the user to enter a value

Posted on 2009-07-07
2
293 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
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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
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, when working with VBA, learn some techniques for writing readable and easily maintained code.

759 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now