473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Clear a combo box on error?

I have a combo box that searches for records in the database. When a
name is typed in that is not in the database, Access shows a message
box that says,

The test you entered isn't an item in the list.
with an "OK" button.

Is there a way to get it to clear the text that has been typed in, or
highlight it when the "OK" button is clicked?

Thanks for any help
Jan 19 '06 #1
4 2252
Yes, use the NotInList event of the combo box.

Example:
Msgbox "You typed an item that isn't in the list. Please try again."
Response = acDataErrContinue
Me.cboMyCombo = Null

--
Wayne Morgan
MS Access MVP
"Shyguy" <sh****@aol.com> wrote in message
news:81********************************@4ax.com...
I have a combo box that searches for records in the database. When a
name is typed in that is not in the database, Access shows a message
box that says,

The test you entered isn't an item in the list.
with an "OK" button.

Is there a way to get it to clear the text that has been typed in, or
highlight it when the "OK" button is clicked?

Thanks for any help

Jan 19 '06 #2
Thank you so much. I've been beating my head against the wall and I
doubt if I would have ever figured that out.

Is there a way to get the message box to center on the form rather
than the screen?

On Thu, 19 Jan 2006 19:16:56 GMT, "Wayne Morgan"
<co***************************@hotmail.com> wrote:
Msgbox "You typed an item that isn't in the list. Please try again."
Response = acDataErrContinue
Me.cboMyCombo = Null


Jan 19 '06 #3
> Is there a way to get the message box to center on the form rather
than the screen?
Not that I know of. Instead of a MsgBox, you could create a form that looks
like a message box and place it where you want it. If you do, open this form
with the acDialog window mode argument of the DoCmd.OpenForm call.

--
Wayne Morgan
MS Access MVP
"Shyguy" <sh****@aol.com> wrote in message
news:bn********************************@4ax.com... Thank you so much. I've been beating my head against the wall and I
doubt if I would have ever figured that out.

Is there a way to get the message box to center on the form rather
than the screen?

Jan 19 '06 #4
Thanks again for the help. I think I'll leave it this way. I like
the way it works and "Enter" closes the box.

On Thu, 19 Jan 2006 21:13:35 GMT, "Wayne Morgan"
<co***************************@hotmail.com> wrote:
Is there a way to get the message box to center on the form rather
than the screen?


Not that I know of. Instead of a MsgBox, you could create a form that looks
like a message box and place it where you want it. If you do, open this form
with the acDialog window mode argument of the DoCmd.OpenForm call.


Jan 20 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: stingrays | last post by:
Below is my code for a combobox. Basically, I have 2 comboboxes. 1 box is the application selection and the other retrieves data from the dataset (SQL Server) to populate the drop down in the...
1
by: SAN CAZIANO | last post by:
how can clear an html SELECT and next insert in it all the elements of an array () I try this but seems doesn't works. function ComboAddArrayValueWithLabel(combo,ArrayLabel,ArrayValue) { ...
5
by: feng | last post by:
In our VB.Net Windows form application we have a combobox pre-populated with a list of items. What I need is simply clear everything from it's dropdown, when a button is clicked. I tried...
6
by: banderson | last post by:
Hello, I have a form and a combo box that I use to filter the form to particular records. I also have an "add new" button that, when clicked, adds a new record. My problem is that the filter combo...
6
by: =?Utf-8?B?amVmZmVyeQ==?= | last post by:
i need help with a combo box and this same code works on my first tab with a combo box. The error or problem i have is this code causes an index out of range error when i run it on my second combo...
1
by: joshapalooza | last post by:
I am using a form to sort a report, but I can't seem to get the "clear form" button to work. I used the wizard when I installed the button, using the clear form option under the form option list....
0
by: dudeja.rajat | last post by:
Hi, In my combo box taken from Tix, how can I delete item in Entry subwiget? My case is like this: I have a check button which when made un-ticked should clear the entry from combo box (i....
0
by: dudeja.rajat | last post by:
Hi, In my combo box taken from Tix, how can I clear the entry subwidget? My case is like this: I have a check button which when made un-ticked should clear the entry from combo box (i....
10
by: bkberg05 | last post by:
Hi - I have a field on a form that is required. It's in a combo box. The combo box is set to Limit to List. Sometimes a user comes into the field and starts typing into the field to locate their...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.