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!

Calculate value for unbound text box in a subform

Status
Not open for further replies.

jaywball

IS-IT--Management
Mar 7, 2006
3
GB
I'm trying to change the value of an unbound text box based on the value of another bound field.

I.e. if collection_date.value is not null then Textbox1.value = 0.

Textbox1's default value is 1

Is this the correct way of doing this. I need to sum the values in my subform footer to show the number of uncollected items.

Thanks in advance.
 
if you are using vba

Textbox1.value = iff( isnull(collection_date.value),0 ,1)

or if you are using it in the controlsource of the textbox1

= iff( isnull(collection_date.value),0 ,1)



Ian Mayor (UK)
Program Error
Always make your words sweet and nice. Because you never know when you may have to eat them.
 
How are ya jaywball . . .

If [blue]collection_date[/blue] resides on the mainform, you'd have:
Code:
[blue]   If IsNull(Me!collection_date) Then [[purple][b]SubFormName[/b][/purple]].Form!Text1=0[/blue]

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

Be sure to see thread181-473997
Also faq181-2886
 
The collection_date is another field on the subform. How would I alter the above code to reflect this?
 
jaywball . . .

Should be:
Code:
[blue]If Not IsNull(Me!collection_date) Then Me!Text1 = 0[/blue]

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

Be sure to see thread181-473997
Also faq181-2886
 
Hi I've tried adding this code in afterupdate but it doesn't seem to work. Is there somewhere else I should be adding the code?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top