Two fields true and two fields false

BillBee

Registered User.
Local time
Today, 12:18
Joined
Aug 31, 2008
Messages
137
I have two fields. Advances (Currency) and Credit (Yes/No)
I would like have it that when an amount is entered into the Advances field it would tick the box in the Credit field. Similarily you cannot tick the Credit box when there is no amount in the Advances field
I am not good at code but something like the following

If Advances = False then
Credit = False
End If

If Advances = True then
Credit = true
End If
Thanks to anyone who can help.
 
why bother with y/n credit control? is this bound to the table? it doesn't need to be.

if not - then simply set the record source for the y/n credit control as this.

iif(nz(advance,0)=0,false,true)

obviously if the control is bound, you cannot do this.

-------
your code isn't quite right, because you are testing the advance field as true/false, but it is numeric.


so this code would work for a bound field.

credit = nz(Advances,0)=0

(which does the same job as if .. then.. else in this instance)

note that you would need this code in the afterupdate event for the advance field, and also in the current event for the form. becuase the status of the credit control is deterimned by the value of the advance, it would need to be locked, so it could not be changed manually.

----

because the value of the credit field is determined by the value of the advance field - it is completely unnecessary, and does not need to be stored within your table. if you have two separate fields, the biggest danger is that somnhow they get set to an "illegal" condition, which would be confusing.
 
Last edited:
Thanks for your reply. I have used a bound field because I wanted a printed report with a ticked check box to show the credit. I think I have followed your instructions correctly(without locking the control). When I enter an amount in the Advance field the Credit box shows no tick, and when closing and the Form a new record appears at the top of the tblFees without an autonumber. What have I done wrong? I accept that the Credit field is not essential but would like to include it.
 

Attachments

Users who are viewing this thread

Back
Top Bottom