Re: cancelling invoice if user says so..

From: Alan Webb (knogeek_at_hotmail.com)
Date: 03/13/04


Date: Sat, 13 Mar 2004 12:35:06 -0500

Jon,
Even better. Your validation would run against the line item table instead
of the invoice header table. But . . . what if a sales person is giving
away something? "I'll throw in a mouse free if you buy the computer today,"
or some such. The invoice should print in spite of the zeroed line item
because it's a legitimate item and a legitimate price. Anyway, pull a query
of any line items with zero amounts and return the invoice header rows that
contain the zeroed line items. Then tell the user these invoices won't
print and add a WHERE clause to your invoice query that leaves out any
invoices with zeroed line items.
Though I'd love to see the face of the sales manager when he figures out
that his sales are stuck in zero balance hell and can't get out and he won't
get his commission this pay period. Sales people don't take it too well
when you tell them they are working for free.

"Jon" <jon@SPAM_OFFtheexperts.co.uk> wrote in message
news:c2va1l$1v1$1@titan.btinternet.com...
> Alan,
>
> The balances have values >0, it's some of the individual items that don't
> have a value
>
> Jon
>
> "Alan Webb" <knogeek@hotmail.com> wrote in message
> news:TWi4c.612$6n5.13257@news.uswest.net...
> Jon,
> I'd do this validation earlier in your process. I'd probably write a
> validation routine that looked for zero balance invoices and told the user
> something like, "Invoices x, y, and z have zero balances and will be
> skipped." Then run the report with a change to the WHERE clause of the
> SELECT statement that the report is bound to so it includes a phrase like
> "BALANCE > 0" and zero balance invoices are not included in the printed
> result set. Then only the invoices that have a balance will print and the
> user has a chance to go fix the ones that didn't print.
>
> "Jon" <jon@SPAM_OFFtheexperts.co.uk> wrote in message
> news:c2qp63$5ti$1@hercules.btinternet.com...
> > Hi I have some code, reproduced below that should prevent an invoice
> > printing with a 0 rate.
> >
> > however, if, for example, there are two items with zero rate the code
> asks
> > the question twice but carries on printing anyway!
> >
> > Can anyone advise how I change the code to stop when the user presses
yes?
> >
> > Thanks
> >
> > Jon
> >
> > ================================== The Code:
> >
> > Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
> > Dim response As String
> > If CalculatedCost = "0" Or Len(Trim$(CalculatedCost & vbNullString)) = 0
> > Then
> > response = MsgBox("There is an cost of 0 (zero) or empty, the invoice
> cannot
> > proceded, would you like to fix that now?", vbYesNo + vbQuestion +
> > vbDefaultButton2)
> > If response = vbYes Then ' User chose Yes.
> > DoCmd.Close acReport, Me.Name
> > Dim stLinkCriteria As String
> > stLinkCriteria = "[InvoiceId]=" & Me![InvoiceId]
> > DoCmd.OpenForm "FrmInvoiceBuilder", , , stLinkCriteria, ,
acDialog
> > Exit Sub
> > Else ' User chose No.
> > DoCmd.Close acReport, Me.Name
> > Exit Sub
> > End If
> > End If
> > End Sub
> >
> >
>
>
>