I am completely new to VBA. I am trying to update a yes/no box in a
subform based on a value that I call from the main form into the
subform. Below is the if /then statement i am using:
If (Me.[BalanceDue] = 0) Then
Me.[PaidInFull] = -1
End If
The called field is [BalanceDue] and the yes/no field is [PaidInFull]
Can someone tell me if my code is correct and secondly, in which Event
occurance should I put the code. I have tried it in the AfterUpdate
and OnChange Events of the "called field" and nothing is working.
I don't think I need an "Else" statement here because the default value
for the yes/no is No. The vast majority of the time our customers are
either paid in full or have paid nothing. In the event that partial
payment has been made, I want the data entry person will go in and
manually trigger if the partial payment covers the cost of a particular
course (product item).
I don't know if this is important but, the called field is called from
the main form. But this field in the main form is called from a
second subform where it is calculated. (I couldn't figure out how to
call the field directly from one subform to another subform)
*******
To answer the eventual question as to why I need to store what looks
like redundant information, my company sells courses and a customer may
purchase multiple courses each with different start dates. We allow
them to make partial payments up to the start date of a course and I
need to show which courses has been paid for in full even if their
total balance isn't paid off.
Thanks for helping.
BillCo - 13 Mar 2006 11:22 GMT
you need to address the field as an object in the subform.
ie. to address it fully:
Forms![ParentFormName]![SubFormName]![FieldName].Value = -1
then, because the subform is not in focus, you will need to refresh it:
[SubFormName].Requery