473,789 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Set Access ComboBox Default Value to First in List

I have a combo box in a subform that will have different options
depending on values in the main form.

I would like the combo box to default to the first value in the list.

Any help would be much appreciated, thanks.

Aug 24 '06 #1
1 24916
an*******@gmail .com wrote in
news:11******** **************@ m73g2000cwd.goo glegroups.com:
I have a combo box in a subform that will have different
options depending on values in the main form.

I would like the combo box to default to the first value in
the list.

Any help would be much appreciated, thanks.

Easy enough to do in code of the OnCurrent Event of the subform

if me.newrecord then
me.combobox.val ue = me.combobox.col umn(index,row)
end if

Index Required Long. A long integer that can range from 0 to
the setting of the ColumnCount property minus one.

Row Optional Variant. An integer that can range from 0 to the
setting of the ListCount property minus 1.

the value for index should correspond to the bound column of the
combobox. if you have only one column and want the first row,
it's column(0,0)
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Aug 25 '06 #2

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

Similar topics

0
334
by: Pierre Gecils | last post by:
I defined a default value for several element of my XML schema. When an element defined with a default value is specified as missing in the respective XML document, I do not receive the default value when I invoke the 'Node.SelectSingleNode ( "Column...".InnerText ) method;'; I receive an empty string Thank you. Pierre
2
8233
by: Terry Bickle | last post by:
Please forgive me for using the wrong term here or there. I'm an old Excel 4 macro guy who didn't convert to VB and I'm tinkering with an Access 2000 DB. I'm sure there is a simple Access 101 answer for this. I have a subform which the user selects an item description from a combo box from a table. I want to obtain the cost for the item (another field in the table) also. I've been able to produce the second data field by rewriting the...
3
5330
by: Todd D. Levy | last post by:
I have a number of Drop Down Combo Boxes where users select a country; 99% of the time the selection will be "United States". I want to use VBA code in the New Record Event to populate this field with "United States" as the default value, but still allow the users to select another value (country) on those rare occasions where it applies. I just want to make sure that this code will not cause any conflicts with the normal functionality...
2
3622
by: Fred | last post by:
Hi, I am having a problem setting a combobox value in code on form load using comboBox.SelectedValue method. The code below when debugging show the combobox equal to an undefined value. The value I am trying to set is present the items collection. I also have tried using .SelectedItem method and I get an object reference error. Any ideas? comboBox.SelectedValue = comboBoxValue;
2
1460
by: chris in grimsby | last post by:
I have a combobox of dropdownlist style as one of the controls on a tabbed form. The list is populated by setting the DataSource property to a dataset and then the DisplayMember and ValueMember properties are set to the names of 2 of the fields in the dataset. I noticed that when the form displays, the combobox defaults to the first item in the list, not to blank (selectedindex=-1) as I would have expected. I can use the...
2
3306
by: Eduardo78 | last post by:
I would like to set the default value of a combobox to "nothing" or spaces when my form loads. I am using the dropdown list property becasue i want the end-user to select only values listed in the combobox. Also keeping the property that when a user enters a letter the cursor goes to the records starting with that letter. Right now when the form loads all the comboboxes have already a value, and I do not it to behave like that, I also...
6
8532
by: carmela_wong | last post by:
Hello all, I am trying to set the default value of a combo box to "USA" which does not work although I have entered this in the Default Value property of the control. The combo box shows the values "USA", "Canada" and "Mexico in the drop-down menu. I am able to accomplish this in a list box but that is not what I want. I need the combo box. Thank you for any advice. CW
3
1704
by: sharperrr | last post by:
Access2000 Hi I have a combobox which displays a list of values dependent on another field. On the fields onchange event the rowsource of the combobox changes according to the value in the field. The problem I have is the combo box displays the last value selected, the list it contains is updated but until the combobox is selected it displays the last value. This is very confusing to the users. Suggestions please. Even a nice easy...
8
3121
Knut Ole
by: Knut Ole | last post by:
hi, i have a combobox that pulls a list from a table, and i've added a "New" button to create a new blank record in the combobox (see below). when i have a new record (ID) in the combobox however, and want to fill that new recordset in, if the value i enter happens to be one that already exists in another record, it will CHOOSE that old record and make it "active," instead of filling in the new record with the new value... so how do i make...
0
9666
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
9511
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
10412
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9986
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
6769
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
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4093
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
3703
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.