From: JohnE on 12 May 2010 11:43 I have a form in which I need to do a default value of one textbox with the value of another textbox. The max warranty txtbox default value should be the contract warranty textbox value. Both fields are bound fields. A majority of time the max will be the same as contract but there are times when max is a longer time period so the user will change the number. How do I make the max default to the contract default? Thanks. John
From: Marshall Barton on 12 May 2010 12:33 JohnE wrote: >I have a form in which I need to do a default value of one textbox with the >value of another textbox. The max warranty txtbox default value should be >the contract warranty textbox value. Both fields are bound fields. A >majority of time the max will be the same as contract but there are times >when max is a longer time period so the user will change the number. How do >I make the max default to the contract default? You can not actually use the DefaultValue property for this kind of thing because it is applied at the first keystroke on new records. So by the time the contract warranty textbox value gets a value, it's too late to make use of the DefaultValue property. Try using a little VBA code in the contract warranty textbox's AfterUpdate event and see if it meets your needs. If IsNull(Me,[max warranty]) Then Me,[max warranty] = Me.[contract warranty] End If -- Marsh MVP [MS Access]
From: KARL DEWEY on 12 May 2010 12:36 This is the chicken & egg scenario. A default is used when you create a record. After the record is created it is not used. You can not set the max warranty txtbox default value to the contract warranty textbox value until contract warranty textbox has a value and it will not have a value until the record is created. You could add a command button to set the max warranty txtbox value to the contract warranty textbox value. -- Build a little, test a little. "JohnE" wrote: > I have a form in which I need to do a default value of one textbox with the > value of another textbox. The max warranty txtbox default value should be > the contract warranty textbox value. Both fields are bound fields. A > majority of time the max will be the same as contract but there are times > when max is a longer time period so the user will change the number. How do > I make the max default to the contract default? > Thanks. > John
From: Jeff Boyce on 12 May 2010 13:18 As you've already read, the "default" only applies to a totally new record. Once you've entered a value in your first texbox, I believe what you're saying is you want the value in the second textbox to match it. Here's some untested code to put into the AfterUpdate event of the first textbox: Me!SecondTextbox = Me!FirstTextbox Good luck! Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "JohnE" <JohnE(a)discussions.microsoft.com> wrote in message news:9CBF8BBF-7177-4635-80B6-9D2EA62A6CFC(a)microsoft.com... >I have a form in which I need to do a default value of one textbox with the > value of another textbox. The max warranty txtbox default value should be > the contract warranty textbox value. Both fields are bound fields. A > majority of time the max will be the same as contract but there are times > when max is a longer time period so the user will change the number. How > do > I make the max default to the contract default? > Thanks. > John
From: JohnE on 12 May 2010 16:24 "JohnE" wrote: > I have a form in which I need to do a default value of one textbox with the > value of another textbox. The max warranty txtbox default value should be > the contract warranty textbox value. Both fields are bound fields. A > majority of time the max will be the same as contract but there are times > when max is a longer time period so the user will change the number. How do > I make the max default to the contract default? > Thanks. > John Thanks to those of you that responded. I will try the different ideas and see which one fits the need. Thanks. John
|
Pages: 1 Prev: Form size changing Next: Code for "OK" in Dialog Box to lead to selected records in Form Vi |