PC Review


Reply
Thread Tools Rate Thread

Better error message when a user enters a value in a form comboboxthat is not valid

 
 
Chrisso
Guest
Posts: n/a
 
      31st Aug 2010
Hi All

I have a form with a combo box that lists valid choices and has "Match
Required" = true.

If a user ignores the pull down on the combo box and enters invalid
data all they get when done is a message saying "Invalid property
value". I cannot see a way of overriding this message like you can do
with cell validation. This message of course meaans nothing to a
normal user and they get very confused.

What is the best way to handle this?

Chrisso?
 
Reply With Quote
 
 
 
 
Chrisso
Guest
Posts: n/a
 
      31st Aug 2010
On 31 Aug, 09:57, Chrisso <chris75sut...@gmail.com> wrote:
> Hi All
>
> I have a form with a combo box that lists valid choices and has "Match
> Required" = true.
>
> If a user ignores the pull down on the combo box and enters invalid
> data all they get when done is a message saying "Invalid property
> value". I cannot see a way of overriding this message like you can do
> with cell validation. This message of course meaans nothing to a
> normal user and they get very confused.
>
> What is the best way to handle this?
>
> Chrisso?


The solution I have implemented runs as follows:


' stop users typing text into the reason combo box as some user think
they can enter what they like in here
' and then get confused when Excel says "Invalid Property Value"
Private Sub cbxReason_Change()
' jump out if user clears the combo box
If IsNull(Me.cbxReason) Then Exit Sub
If Me.cbxReason = vbNullString Then Exit Sub
' exit if a value is entered via the pull down and appears in the
the combo box row source - a range name of allowable values:
If Value_In_Range_Name_List("REASON_CATEGORIES",
Me.cbxReason.Value) Then Exit Sub

' stop users entering garbage in this combo box before they get a
useless Excel message:
Me.cbxReason = Null
MsgBox "Please use the pull down.", vbExclamation, "Hint"
End Sub

Public Function Value_In_Range_Name_List(sListName As String, sValue
As String) As Boolean
Value_In_Range_Name_List = Not
ThisWorkbook.Names(sListName).RefersToRange.Cells.Find(sValue, ,
xlValues, xlWhole) Is Nothing
End Function

Hope this helps others or spurs someone to show me a better solution.

Chrisso
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter For Throws Error when user enters 'in' RossW Microsoft Access VBA Modules 5 12th Sep 2008 02:24 AM
Update Sub form as user enters data in main form cableguy47905 via AccessMonster.com Microsoft Access Forms 4 19th Jun 2007 09:26 PM
Opening assigned tasks user gets error message fields not valid. =?Utf-8?B?VHJlbWFpbmUgV3JpZ2xleQ==?= Microsoft Outlook Discussion 0 4th Oct 2006 10:25 PM
Display record in a form after user enters criteria using dialog b =?Utf-8?B?bmVlZCBzb21lIGhlbHAgb3ZlciBoZXJl?= Microsoft Access Forms 1 24th Feb 2005 01:59 PM
form: cursor stays on field until user enters data Mark Microsoft Access Form Coding 2 21st Sep 2003 03:26 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:17 AM.