INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

I'm creating an invoice using a sou

I'm creating an invoice using a sou

(OP)
I'm creating an invoice using a source that includes a LoyaltyDiscount, and this is displayed on the report.

Depending on its value I want to display a thank you message in a text box called DiscountText in the footer section. The code below in the Detail section doesn't fire so I get the text every time. Tried repeating the code in the footer but it still doesn't fire.

CODE -->

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

   'Controls whether or not to show Loyalty Discount
    If Me.LoyaltyDiscount = 0 Then
        Me.DiscountText.Visible = False
    Else
        Me.DiscountText.Visible = True
    End If

End Sub 

This same invoice is a redesign of one where the Loyalty Discount was calculated in the report instead of being in the source query, and this is the only difference, I think. LoyaltyDiscount displays properly in the new design.

Any clues?

RE: I'm creating an invoice using a sou

(OP)
Sorry, goofed by not including a subject.

RE: I'm creating an invoice using a sou

Why use code? Can't you simply set the control source to something like:

CODE --> ControlSource

=IIf(Nz([LoyaltyDiscount],0) = 0,"", Format([LoyaltyDiscount],"percent")) 

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016

RE: I'm creating an invoice using a sou

(OP)
Thanks Duane, also set the box so it could shrink.

This is the new source, which works both with zero or positive LoyaltyDiscount.

=IIf(Nz([LoyaltyDiscount],0)=0,"","We are pleased to include in your Invoice amount an additional Loyalty Discount of £" & Round([LoyaltyDiscount],2) & " based on your recent orders.")

RE: I'm creating an invoice using a sou

The only enhancement I would offer is to store the "We are pleased..." in a table so it's not hard-coded in an expression. Everything in this world changes so I typically store data values in tables where they can more easily be maintained.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close