Autofilling a field with equal data if a previous field is >9999

D

DMainland

I use a subform to enter transaction information. If the field,
[GrossAmount], is greater than 9999, I would like a subsequent field on the
same subform, [CashIn], to autofill the same amount as the [GrossAmount]
field so the user doesn't have to enter the data twice in the event the
figure is over 9999. Any help would be greatly appreciated.
 
J

John W. Vinson

I use a subform to enter transaction information. If the field,
[GrossAmount], is greater than 9999, I would like a subsequent field on the
same subform, [CashIn], to autofill the same amount as the [GrossAmount]
field so the user doesn't have to enter the data twice in the event the
figure is over 9999. Any help would be greatly appreciated.

Ummmm...

WHY!?

It sounds like you're storing the GrossAmount redundantly in two fields. Are
these two fields in the same table? What *real life problem* are you trying to
solve with this redundancy?

What you can do - if this really is necessary - is to use VBA code in the
Afterupdate event of the GrossAmount control. Let's assume that the form
textbox txtGrossAmount is bound to GrossAmount; that txtCashIn is bound to
CashIn; and that you don't mind blindly stomping on already existing values of
CashIn:

Private Sub txtGrossAmount_AfterUpdate()
If Me!txtGrossAmount > 9999 Then
Me!txtCashIn = Me!txtGrossAmount
End If
End Sub

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top