Re-Assign Calculated field

  • Thread starter Thread starter Project Coordinator
  • Start date Start date
P

Project Coordinator

I have creat database to track project costs. Occasionally invoices do not
match purchase orders because vendors send in more mterial or close enough
quantities. I would like to be able to check box (yes/no) that when checked
yes changes the calculated to $0.00 showing the invoice closed. Don't have a
clue how to do it. Thanks in advance for any help.
 
Hi

I assum you have a form with
Text box named txtCalculatedControl
Tckbox name cbxInvoiceClosed

Open your form in design view
Open the properties box for cbxInvoiceClosed

On the afterUpdate event put this


Private Sub cbxInvoiceClosed_AfterUpdate()
Dim msg, style, title, ctext, responce, mystring
Dim stDocName As String
Dim stLinkCriteria As String
If Me.cbxInvoiceClosed = -1 Then
msg = "Are you sure you want to close this invoice" & vbCrLf & "and
reset the amount to 0 ?"
style = vbYesNo
title = "Close Invoice"
responce = MsgBox(msg, style, title)
If responce = vbYes Then
Me.txtCalculatedControl = 0
End If
End If
End Sub




Hope this helps
 
If we take the Orders form in the sample Northwind database as an example
you'll see that its Total control has as its ControlSource property the
following expression:

=[Subtotal]+[Freight]

If a Boolean (Yes/No) field IsClosed is added to the underlying Orders table
and a check box on the form is bound to it, amending the expression to:

=([Subtotal]+[Freight])*IIf([IsClosed],0,1)

will set the value to zero if the check box is checked, and to the actual
total of the order if not. It would be done in exactly the same way for an
invoice.

Ken Sheridan
Stafford, England
 
Back
Top