Form Combo Boxes (1 Viewer)

Acme

Registered User.
Local time
Today, 00:37
Joined
Jun 14, 2013
Messages
81
Glad I am testing my database. I have found a problem that I was hoping to get help with.

I have a couple forms with Combo boxes that look up data in queries. I noticed in testing that I could accidently type a "~" (and other characters) in the field and once I do, it causes a runtime error that shuts down the entire app (as opposed to letting the user backspace out of it or resetting the field). Before I put in some "Before Update" code to prevent the system from crashing, I want to make sure I am on the right track. I have already set the combo box to just show the list, not allow edits, limit to list, etc. Is there a way to prevent the user from doing this either by preventing the keyboard from working on combo boxes (not preferred) or by trapping it before the system crashes? I would think I could validate with a recordset, and create my own path out for the user, but I was hoping the combo box would have sort of done that work for me.
 

Acme

Registered User.
Local time
Today, 00:37
Joined
Jun 14, 2013
Messages
81
An update here. I think the issue was that my code was only checking that the combo box field was populated before performing calculations, and that the invalid value was able to make it through. I could add logic to ensure that the combo box value exists in a query, but I found it easier to nullify key presses on the few combo boxes presenting this issue. I opted for this approach to prevent the user from wasting their time dealing with invalid error boxes.
 

Users who are viewing this thread

Top Bottom