473,831 Members | 2,237 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2291
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 = acDataErrContin ue
Me.cboMyCombo = Null

--
Wayne Morgan
MS Access MVP
"Shyguy" <sh****@aol.com > wrote in message
news:81******** *************** *********@4ax.c om...
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 = acDataErrContin ue
Me.cboMyComb o = 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.c om... 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
630
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 otehr box. I want to make a selection in the app combobox, update the second box and when I select a new app, it should remove all items in teh 2nd combobox and refresh the list with only the selected app. With this code it appears the binding is...
1
10131
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) { combo.options.length = 0; for (i=0; i<ArrayLabel.length; i++) combo.options = new Option(ArrayLabel,ArrayValue); }
5
59474
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 everything I can think of, such as set data source to nothing, etc., but still not been able to make it happen. Can someone show me how to do it? Thanks
6
5037
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 box stays on the old selection when the new record pops up. I would like to have the combo box clear or set to a default value of "New" when the Add New button is clicked or when the user clicks on the * (new record) button in the navigation bar. ...
6
1878
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 box: (errored code) Select Case ComboBox2.text Case Is ="Execute Program" 'code to execute program here Case Is ="Other Command that executes code at a certain time" ' code below the same as above except that it works But not my first(this...
1
5712
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. What I want to be able to do is clear the information on the drop down combo box in case I want to change the sort order. This is what the code looks like now: Option Compare Database Private Sub close_Click() On Error GoTo Err_close_Click ...
0
829
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. anything selected in combo box previously) I used the following commands:
0
941
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. anything selected in combo box previously) I used the following commands:
10
1782
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 record. But the record doesn't exist. So they backspace over the data they entered and try to leave the field (to go hit a button to add the record they need) and they get a message saying the field is required and can't be null. However, if they...
0
9793
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10493
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10206
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9315
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5617
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3960
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.