Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Defining Default Value 1

Status
Not open for further replies.

BeallDon

Technical User
Aug 20, 2007
46
CA
I am having some problems setting a default value. The form is simple, i have a field "StartingAmount", and another field "ConfirmedAmount". I want "ConfirmedAmount" to default the same as "StartingAmount" but i also need the ability to alter "confirmedamount". I've tried a few different things, but have given me the wrong results. The form will have multiple records, and each record will have different values in both fields.
 
Hi Jed,

Enter following in it's Controlsource:
[tt]
=if(isnull([ConfirmedAmmount]),[StartingAmount],[ConfirmedAmount])
[/tt]
This means that regardless of whether or not this is a new record, it will equal StartingAmount if it is ever empty.
If it has a value - then it retains this value.

ATB

Darrylle



Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
 
How are ya Jedody69 . . .
Jedody69 said:
[blue]The form will have multiple records, and each record will have different values in both fields.[/blue]
Your misunderstanding the meaning of [blue]default[/blue] here. What you require is an initial value based on another (when it has a value). In the [blue]AfterUpdate[/blue] event of [blue]StartingAmount[/blue]:
Code:
[blue]   Me!ConfirmedAmount = Me!StartingAmount[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
Thanks Darrylles, but I tried that one and it results in an #error. TheAceMan1 is the winner here. Thanks AceMan, that's exactly what I was trying to accomplish - works perfectly. Much appreciated!!

Any suggestion on what additional code I would require in the event that I wanted to delete the value in ConfirmedAmount via the form and wanted ConfirmedAmount to re-initialize back to StartingAmount?
 
Jedody69 . . .

You have to decide or brainstorm [blue]what will trigger this reinitialize? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
IsNull....Thanks AceMan. I actually realized the about 2 minutes after I posted the question (d-uh me). OK, here's one that I haven't figured out yet: What if StartingAmount is on a different form - such as "Main Form" and ConfirmedAmount is on "Working Form"? How do i connect them in VBA?
 
Code:
[blue]   [[purple][b][i]subFormName[/i][/b][/purple]].Form!ConfirmedAmount = Me!StartingAmount[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top