Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access Combo Box - force the user to enter a value

Posted on 2009-07-07
2
Medium Priority
?
359 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 2000 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

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.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

610 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