473,425 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

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.defaultvalue = 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 1986
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.defaultvalue = 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.DefaultValue = Me!ComboName

' Then save the value to the table.
CurrentDb.Execute "Update tblDefault Set tblDefault.NewDefault = " &
Me.ComboName & ";",dbFailOnError

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.DefaultValue = DLookUp("[NewDefault]","tblDefault")

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
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...
2
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...
21
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...
1
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()...
2
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...
50
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...
2
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...
4
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
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...
5
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...
0
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...
0
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...

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.