Have an option to enter data in a field or auto populate

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with a yes/no check box where I need the following conditions:

If checked (yes), then have it automatically populate the field based on a
caculation from 2 fields, and if uncheckd (no), then have it remain blank and
allow me to enter a manual number (per cent). It must retain this
information for a single record and as I move from record to record, I need
to include this in the "current record" procedure.

I will be more than happy to share the code with anybody who feels they can
help me.
 
Use the AfterUpdate event procedure of the check box to assign the result to
the 3rd field.

Private Sub Checkbox1_AfterUpdate()
If Me.Checkbox1.Value Then
Me.[Amount] = Me.[FirstFee] + Me.[SecondFee]
End If
End Sub
 
Allen,
This worked but doesnt' save the vaule if they accidentally uncheck and
check the box., I can put a warning that this will reset.

Thanks for the input.

Steve



Allen Browne said:
Use the AfterUpdate event procedure of the check box to assign the result to
the 3rd field.

Private Sub Checkbox1_AfterUpdate()
If Me.Checkbox1.Value Then
Me.[Amount] = Me.[FirstFee] + Me.[SecondFee]
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Optomyst said:
I have a form with a yes/no check box where I need the following
conditions:

If checked (yes), then have it automatically populate the field based on a
caculation from 2 fields, and if uncheckd (no), then have it remain blank
and
allow me to enter a manual number (per cent). It must retain this
information for a single record and as I move from record to record, I
need
to include this in the "current record" procedure.

I will be more than happy to share the code with anybody who feels they
can
help me.
 
To save the value to the field, set the Control Source property of the text
box (named Amount in our example) to the name of the field where the value
should be saved.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Optomyst said:
Allen,
This worked but doesnt' save the vaule if they accidentally uncheck and
check the box., I can put a warning that this will reset.

Thanks for the input.

Steve



Allen Browne said:
Use the AfterUpdate event procedure of the check box to assign the result
to
the 3rd field.

Private Sub Checkbox1_AfterUpdate()
If Me.Checkbox1.Value Then
Me.[Amount] = Me.[FirstFee] + Me.[SecondFee]
End If
End Sub


Optomyst said:
I have a form with a yes/no check box where I need the following
conditions:

If checked (yes), then have it automatically populate the field based
on a
caculation from 2 fields, and if uncheckd (no), then have it remain
blank
and
allow me to enter a manual number (per cent). It must retain this
information for a single record and as I move from record to record, I
need
to include this in the "current record" procedure.

I will be more than happy to share the code with anybody who feels they
can
help me.
 
Back
Top