473,796 Members | 2,429 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

combo default value, cannot get back to after clear

Thanks to the news group I can now clear a list box. The default value in
properties of the combo is set to "please select a year".

the code Me.CBDOSYear = Me.CBDOSYear.It emData(0)

however this relates to the first year in the list, itried -1 to get it back
to the default value how do I do that as -1 didnt work

regards in advance
Nov 13 '05 #1
1 2017
Peter Bailey wrote:
Thanks to the news group I can now clear a list box. The default value in
properties of the combo is set to "please select a year".

the code Me.CBDOSYear = Me.CBDOSYear.It emData(0)

however this relates to the first year in the list, itried -1 to get it back
to the default value how do I do that as -1 didnt work

regards in advance


Sometimes what I'll do is create a column value in the query/rowsource
to sort on...plus hide by setting the column width to 0 for it. So in a
row I would have a column equal to 0 for "please select a year" and 1
(or 2003) for 2003 and 2 (or 2004) for 2004. If you have such a scheme,
this would float to the top and your ItemData(0) line would work.

Is "please select a year" at the bottom of the list? If you know the
Index value of "please select a year", the your default needs to point
to that index value, not 0. You could get that with ListCount() minus
1. Ex:
Me.CBDOSYear = Me.CBDOSYear.It emData(Me.CBDOS Year.ListCount -1)
I can also check to see if that column is 0 or a value number.
Nov 13 '05 #2

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

Similar topics

2
2047
by: A | last post by:
I have a combo box that is databound to an ArrayList (IList to be more exact) I have a situation where if the user cancels a save I want the combo value to go back to blank. This should be SIMPLE. I have set the SelectedIndex to -1 I have set the SelectedValue to any option under the sun I have set the every other known property to a value that would clear the currently selected option.
14
4973
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons for things like delete, save, edit, cancel buttons - in the footer, or on the form detail section? 2. If in the footer, how do you add them to the tab order?
9
32626
by: Vmusic | last post by:
Hi, I'm using MS Access 2002. I have a form with a combo box built from a query that returns one column, and that one column is the bound column. How do you use VBA to programmatically change which row in the combo box is selected?? I looked at the forum and the answers aren't very clear. Of course the MS Access help file is worthless.
8
2203
by: AA Arens | last post by:
Hi I do have a products table and products-parts table in my Access 2003 database and log all services into a form. I do have at least the following two combo boxes on my form: - Choose Product where as the Row Source (See properties): SELECT tblProducts.ProductName, tblProducts.ProductName FROM tblProducts ORDER BY ProductName;
12
12138
by: Doogie | last post by:
How do I make a value the default value for a combo box in ASP 3.0? What I have below does NOT work, yet I've seen it in HTML file examples before (and works if I put it in a HTML file by itself, but not if I use it in a ASP 3.0 app. <select name="cboCompany" style="text-align:right; font-size:8pt"> <option value="08">08</option> <option value="09" selected="true">09</option> <option value="33">33</option>
6
5035
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. ...
0
1257
by: bz | last post by:
Hi, I have a datagrid with two columns Region and City Both have combo-boxes. City column is unbound What I want is, when use select a region, to fill the combo for City column with appropriate cities for that region I did this with a code like this private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)
2
6526
kmartinenko
by: kmartinenko | last post by:
Hi everyone, I have several combo boxes on my form, and while I have designated a column head, I cannot figure out how to default to the column head value. What I really want is for all of my combo boxes to default to a selection that is either blank or the column head, so that my users don't see their previous selection when they go and select a value from the drop down list. Also, what would be the best way to enable a user to clear out...
7
3582
by: Brad Pears | last post by:
I have something strange going on - pretty sure it used to work before - and now it does not... Why does the following code not clear a combo box? Me.cboLocation.Text = String.Empty OR Me.cboLocation.Text = ""
0
9680
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...
1
10174
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10012
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
9052
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
6788
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
5442
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...
0
5575
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4118
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
3731
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.