?
Solved

Access Combo Box - force the user to enter a value

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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
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.
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

770 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