My combo box is pulling data from tblAccounts using its PK (auto number) AccountID but displaying AccountNo (text).
Is it possible to set the default value for this combo box to one of the AccountNos?
Let me explain AccountID = 1 AccountNo = 4xxxx
I would like cboAccount which is a combo box on a subform (sfrmGrantBudget) to display "xxxxx" as a default value. Is it possible? When I tried, it displays the AccountID for AccountNo XXXXX tblGrantBudget is related to tblAccounts with a join type of 1.
Thanks.
5 2235 ChipR 1,287
Recognized Expert Top Contributor
M,
I had no problem setting a default for a combo box in a quick test. Is your combo box bound to column 1 (accountID) and displaying 2 columns, with the first 0"? Did you attempt to set the default value on the Data tab of the combo box properties to an account ID?
Answer to all your questions are YES.
On the Data tab: I have
Bound Column = 1
Control Source = AccountID
Row Source = SELECT tblAccounts.Acc ountID, tblAccounts.Acc tNo, tblAccounts.Acc tDescr FROM tblAccounts;
Format Tab:
Column Count = 2
Column Widths = 0"; 1";
I guess I must not be doing something right somewhere.
You need to set the "Column Count" property for the combo box to 2. Then if you only want it to display the AccountNo but not the AccountID you would set the "Column Widths" property to something like 0";2" thus hiding the first column containing the AccountID
What you end up with is a combo box that displays the AccountNo but is bound to the AccountID.
DonRayner:
I have no problem with displaying the data as you described. However, my problem lies when I select a default value to read, for example,
AccountNo as "4XXXX" it displays AccountID 91.
Thanks.
Hi. You are confusing the value of the account number displayed - the 4XXXXX bit - with the value of the bound column.
The default value in the case of a combo box applies to the bound column, regardless of which columns are visible and which are hidden.
As the controlsource of the combo is AccountID, presumably a long-integer number generated by an autonumber field in the related table, the bound value should also be a long-integer number.
In the example you give, the 4XXXXX bit corresponds to an AccountID of 1, so 1 should be your default value for the combo if that is the value you want to display. If the default value you want is a different account number, you will need to supply the actual ID number for that value (e.g. 91, say, or whatever other long-int ID value matches the account number concerned). You will see all of this more clearly if you do not set columns to hidden to begin with.
-Stewart
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: the.theorist |
last post by:
I have a small, simple class which contains a dictionary (and some
other stuff, not shown). I then have a container class (Big) that holds
some instances of the simple class. When I try to edit the elements of
the dictionary, all instances obtain those changes; I want each
instance to hold separate entries.
#----------Begin module test.py
class ex:
def __init__(self, val={}):
self.value = val
|
by: MLH |
last post by:
I have an A97 table with a Yes/No field named
TowJob and a form bound to that table. The
TowJob control on the form is bound to the same
field. It is an option group with Yes and No bttns
valued at -1 and 0 respectively.
Unless I specifically set the table field's defaultvalue
to Null, the form comes up with an automatic value
of 0 in the control? The control has NO default
value property setting. Why is that?
|
by: Dixie |
last post by:
Can I set the Format property in a date/time field in code?
Can I set the Input Mask in a date/time field in code?
Can I set the Format of a Yes/No field to Checkbox in code?
I am working on a remote update of tables and fields and can't find enough
information on these things.
Also, how do you index a field in code?
|
by: Marty McFly |
last post by:
Hello,
I have a control class that inherits from System.Web.UI.WebControls.Button.
When I drag this control from the "My User Controls" tab in the toolbox onto
the form, I want it to reflect the following default properties: Height =
32px, Width = 144px.
I declare the Width property in my control as...
\\\
|
by: Barbara Lindsey |
last post by:
I have a case where I am collecting a "Start Date" and an "End Date".
I would like to default the "End Date" to the "Start Date" value if only
the "Start Date" is entered.
I tried setting this as default on the table, but it was not permitted.
So, now I am trying to figure out how to do it with a trigger or
trigger/function combination.
I tried doing it with a rule using "INSTEAD" on INSERT, but that gave an
"endless recursion" error,...
| |
by: laredotornado |
last post by:
Hi,
I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed
using Apache's apxs and the php library was installed to
/usr/local/php. However, when I set my "error_reporting" setting to be
"E_ALL", notices are still not getting reported. The perms on my file
are 664, with owner root and group root. The php.ini file is located
at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem
to be having an effect? ...
|
by: Brad Baker |
last post by:
I have an asp.net/csharp application that requires a particular variable to
work properly. This variable is usually passed via a query string in the URL
when the application is first run but under certain circumstances the query
string may not contain the variable. So I need some way of establishing a
default value if one isn't set.
Is there some way I can set a query string on page_load OR is there some way
I can use a global variable...
|
by: Andrus |
last post by:
..NET 2 Winforms application.
How to create new setting and set it default value in userSettings section
of app.config file or overwrite existing setting value ?
I found code below in this list which modifies Application setting section
but how to add new item to userSettings ?
Andrus.
|
by: PetterL |
last post by:
I have a setting called My.settings.firstrun set to True, set in the setting
manager. When i read this in the first form form_Load in a IF sentence it
always come out as false.
I have tried to change the setting from string to Boolean but no help.
|
by: RobertTheProgrammer |
last post by:
Hi all,
I have a perplexing problem here. I've developed some software using ASP.NET with C# in the code behind. I've been setting the "window.defaultStatus" in the code behind to send messages in the status bar to the user about their last actions (page loaded successfully, record stored successfully, etc.) I've been setting the "window.status" message with the JavaScript "onmouseover" event for various actions on the screen (click here...
|
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...
| |
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...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |