473,799 Members | 3,093 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

default value help

ken
Hi,
I want to reset the default value of a combo box everytime someone
selects something from its list.
I have in the after update event combo.defaultva lue = combo.value.
Anyhow this works, as long as I don't close the form. Once I close it
the new defalut value does not get saved. Is there any way I could save
it to the properties of the combo box?

Thanks,
Using A2k.

Dec 16 '05 #1
3 2007
On 15 Dec 2005 18:03:54 -0800, ken wrote:
Hi,
I want to reset the default value of a combo box everytime someone
selects something from its list.
I have in the after update event combo.defaultva lue = combo.value.
Anyhow this works, as long as I don't close the form. Once I close it
the new defalut value does not get saved. Is there any way I could save
it to the properties of the combo box?

Thanks,
Using A2k.


You cannot save a change in a combo box property unless you change it
in Design View.

I would suggest you create a table with one field and one record.

Field Name NewDefault Set it's datatype to whatever the
datatype is of the combo box bound column.
Table Name tblDefault

to store whatever the last selected value is (in the Combo AfterUpdate
event)

' First change the default value for use while this form is still
open.
Me!ComboName.De faultValue = Me!ComboName

' Then save the value to the table.
CurrentDb.Execu te "Update tblDefault Set tblDefault.NewD efault = " &
Me.ComboName & ";",dbFailOnErr or

The above assumes the bound column is a Number datatype.

Then DLookUp that value when you next open the form (in the Form's
Load event):

Me!ComboName.De faultValue = DLookUp("[NewDefault]","tblDefau lt")

You do know, I hope, that the DefaultValue will only come into play
for new records?
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Dec 16 '05 #2
ken
>You do know, I hope, that the DefaultValue will only come into play
for new records?

Yes I know this...

I was hoping there would be another way other then making a tblDefault.
I wonder if I can use globals maybe? But I think they will be lost
after you close the form too.... I'll have to play with it.

Thanks for your help.

Dec 16 '05 #3
ken wrote:
You do know, I hope, that the DefaultValue will only come into play
for new records?

Yes I know this...

I was hoping there would be another way other then making a
tblDefault. I wonder if I can use globals maybe? But I think they
will be lost after you close the form too.... I'll have to play with
it.

Thanks for your help.


If you need the default value to persist between form sessions you could put it
into a global variable. Some prefer to use controls on a hidden form for this
(global variables not being very stylish these days).

If you need the default value to persist between application sessions then you
should store it in a table and retrieve it when the form opens.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Dec 16 '05 #4

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

Similar topics

4
2936
by: Lénaïc Huard | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, I've some namespace problems when defining default values for attributes. My problem seems to come from the fact that the attributes are defined in a different namespace from the element.
2
2123
by: CSDunn | last post by:
Hello, I have a field called 'TestGrade'in a subform called 'frmSelectByTestSub'that I need to assign a default value to, and the value needs to be an integer value that is exactly the same as the value in a field called 'Grade' that is also in the subform. The name of the main form is 'frmSelectByTest'. The 'SourceObject' of the subform and the subform name are the same. 'Grade' in the subform can be different for each student record...
21
8778
by: planetthoughtful | last post by:
Hi All, As always, my posts come with a 'Warning: Newbie lies ahead!' disclaimer... I'm wondering if it's possible, using raw_input(), to provide a 'default' value with the prompt? I would like to include the ability to edit an existing value (drawn from an SQLite table) using a DOS console Python app, but my gut
1
1601
by: evanburen | last post by:
When my page loads, I check for the existence of a cookie value through readCookie(). If there is a value present for the cookie, I would like that to be the default value in function ordering() and that value to be the SELECTED value in ddlProfileNames. In other words, if there is no cookie value, then function ordering will default to ordering("Div1,Div2,Div3,Div4"). If there is a value, then that should be used in function ordering...
2
3282
by: Bob | last post by:
I have a CreatedOn field , datetime, which has GetDate() as the default value in SQL server 2000 table. When I create a new record in the table itself in enterprise manager, the field gets populated OK, but when I try to create a new record with a Microsoft datagridview control, I notice that the datecreated value does not get created. It looks as if the datagridview insert statements overrides the default value and prevent the default...
50
3338
by: LaundroMat | last post by:
Suppose I have this function: def f(var=1): return var*2 What value do I have to pass to f() if I want it to evaluate var to 1? I know that f() will return 2, but what if I absolutely want to pass a value to f()? "None" doesn't seem to work.. Thanks in advance.
2
11233
by: tezza98 | last post by:
Help please, Im using SQL server Management Studio Express and i want to change the default value of a varchar(50) column. i want the defaultdate to be like this '5/04/2007 11:15 pm System generated' So i have tried to do this: (getDate())+'System generated' (getdate()).'System generated' but neither seem to work
4
17282
by: Dave Burns | last post by:
Hello, I am trying to specify a logical default value for a in a WCF Web Service using basicHttpBinding. I realize that the language defaults are: int - 0 string - null bool - false
7
4268
by: =?Utf-8?B?Y291Z2FyaXN0aWM=?= | last post by:
I am trying to convert an C# application to VB and have one issue which is converting the generic value to the default. C# uses return default(T) as the return value how would I translate this in VB.Net Thanks
5
6267
by: sillyr | last post by:
Hi- I'm using Access 2007. I wanted to change a default value for a field that previously had no default value. I though it would be easy- just set the default value setting to the number t hat I would like. There was originally no default value and now I would like t he default value to be 12. The data type is number, long integer. The field display control is a combo box, the row source type is Table/Query and the row source is another...
0
9538
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
10473
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
10025
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
9068
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...
1
7563
isladogs
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...
0
5461
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
5584
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2937
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.