473,803 Members | 2,913 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combo box default value

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

Jun 6 '06 #1
6 8533
ca**********@ho tmail.com wrote:
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


Is the RowSource a ValueList?

Is the control Bound?

Is there more than one column (including hidden ones)?

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jun 6 '06 #2
Yes, RowSource is a Value List and the control is bound. There are no
more columns.
Thanks for replying
CW

Jun 6 '06 #3
ca**********@ho tmail.com wrote:
Yes, RowSource is a Value List and the control is bound. There are no
more columns.
Thanks for replying
CW


And you are definitely moving to a new record when opening the form?

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jun 6 '06 #4
Here is what happens: I look up an Order number on the main form. The
subform shows all the line items for that order. It is that subform
that has the combo box. I want it to show USA as the default which then
gets saved in the country field of each record for the order. Country
could be changed to Canada or Mexico prior to saving. The wierd thing I
just noticed is that the value does not get saved in the country field
unless I go and select country value for each line individually. It
does not just save the default value in the field.
Thanks

Jun 6 '06 #5
ca**********@ho tmail.com wrote:
Here is what happens: I look up an Order number on the main form. The
subform shows all the line items for that order. It is that subform
that has the combo box. I want it to show USA as the default which
then gets saved in the country field of each record for the order.
Country could be changed to Canada or Mexico prior to saving. The
wierd thing I just noticed is that the value does not get saved in
the country field unless I go and select country value for each line
individually. It does not just save the default value in the field.
Thanks


The default value only applies to NEW records. If you added this field and
ComboBox and then look at existing orders it is going to still show null
because that is the value stored in those records. If you look at the last
"new record" row on your subform you should see the default value show up
there.

For existing records you would need to run an update query to set them all
to USA and then you could use the ComboBox on individual records that needed
to be set to something else.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jun 6 '06 #6
Thank you for your help. I understand how this works now.
Have a great day!

Jun 6 '06 #7

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

Similar topics

5
17218
by: Harry Haller | last post by:
<select name="cboPlaces" id="cboPlaces"> <option value="3">Countryside</option> <option value="4">Forest</option> <option value="5">Mountain</option> <option value="6">Desert</option> <option value="7">Jungle</option> <option value="7">Swamp</option> <option value="8">River</option> <option value="12">Town</option> <option value="9">Sea</option>
4
4283
by: Heather | last post by:
Hi I am desparately looking for advice in relation to storing the results after selecting items from two combo boxes on a Referral form. The first combo box 'ctl Type' displays a full list of Agency Types, then the 2nd combo box displays a list of Organisations, depending upon the Agency Type Selected. The first combo box 'ctlType' (Unbound), Row Source: to field in 'AgencyReferralType'.
2
5475
by: Sean | last post by:
Greetings all, I am attempting to make a form that will filter through several tables that (I believe) have refretial integrity. I am pulling data from several tables into the form and i would like to eventually be able to filter down through the tables untill i can reach one unique record. I am creating a datbase to keep track of registered accounts for a stae program. Each account is registered into the program through a two...
8
18400
by: Lyn | last post by:
Hi, Can anyone tell me how the initial value displayed in Combo Box is determined when a form is opened? I am loading the dropdown from one field ("CategoryName") of a table, with "ORDER BY ". The values in the dropdown are loaded in the correct order, but the initial value is not the first row of the dropdown as I expected. The field "CategoryName" is not the primary key for the table -- the PK is
0
1997
by: northshore | last post by:
Hello, I am creating a windows application database. I have a primary table 'Individuals' and a lookup table 'Prefixes.' In the Individuals table, I have a column 'PrefixID' that references values of prefixes from the Prefix table based on the PrefixID in the Prefix table. When I load a windows application form, I can display and update data from the primary table. This includes the prefixID value. If I display a combo box with...
8
2206
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;
3
2635
by: Torilyn73 | last post by:
I posted this earlier... or thought I did... anyway.. it's doesn't appear in the list so I'm reposting it. Can someone please explain to me how to set up the lostfocus event for a combo box. I need the combo to return to its default value when the user clicks away from it ... either somewhere on the form itself or another app. I have no clue how to do this and would really appreciate some help. Thanks!
2
24892
by: Brad Pears | last post by:
In my vb.net 2005 project I have a few combo boxes where I want to set a default value. I am not binding these combo boxes - I am loading the values directly in code from a dataset. Obviously the default I am settign will be one of the values from teh drop down list.. How do you set a default value for a combo box?? Thanks, Brad
2
6528
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...
0
10555
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
10317
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...
1
10300
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
10069
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
9127
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
5503
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
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2974
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.