Results 1 to 3 of 3

Thread: Format Reports

  1. #1
    Join Date
    Jan 2011
    Posts
    83

    Unanswered: Format Reports

    I have a report which runs a series of Sales Orders. 1 x Sales order per page and the report usually has approx 12 orders.

    Some orders are in £Sterling and others are in Euros.

    On the Report_Format event, I run code which changes the currency on each sales order. My problem is that if say sales order 7 is in Euros I get the following reults.

    1 - 6 Sterling
    7 - 12 Euros

    What should happen is:

    1 - 6 Sterling
    7 Euros
    8 - 12 Sterling

    I am thinking my code is in the wrong event. If I want the code to check and run at the start of each page, which event should my code be in?

    My code is:

    If EuroOrder = -1 Then
    txtUnitPrice.Format = "euro"
    txtTotal.Format = "euro"
    Reports!rptsalesorderdaily!rptSalesAdditionalsSub! UnitPrice.Format = "euro"
    Reports!rptsalesorderdaily!rptSalesAdditionalsSub! txtTotal2.Format = "euro"
    txtSubTotal.Format = "euro"
    End If

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    you need to bear in mind that having once set a value then you need to reset on change
    Code:
    If EuroOrder = -1 Then
      txtUnitPrice.Format = "euro"
      txtTotal.Format = "euro"
      Reports!rptsalesorderdaily!rptSalesAdditionalsSub! UnitPrice.Format = "euro"
      Reports!rptsalesorderdaily!rptSalesAdditionalsSub! txtTotal2.Format = "euro"
      txtSubTotal.Format = "euro"
    else
      txtUnitPrice.Format = "sterling"
      txtTotal.Format = "sterling"
      Reports!rptsalesorderdaily!rptSalesAdditionalsSub! UnitPrice.Format = "sterling"
      Reports!rptsalesorderdaily!rptSalesAdditionalsSub! txtTotal2.Format = "sterling"
      txtSubTotal.Format = "sterling"
    End If
    endif
    or another way of expressing the same functionality
    Code:
    dim CurrencyName as string
    If EuroOrder = -1 Then
      CurrencyName = "euro"
    else
      currencyname = "sterling"
    endif
    txtUnitPrice.Format = CurrencyName
    txtTotal.Format = CurrencyName
    Reports!rptsalesorderdaily!rptSalesAdditionalsSub! UnitPrice.Format = CurrencyName
    Reports!rptsalesorderdaily!rptSalesAdditionalsSub! txtTotal2.Format = CurrencyName
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jan 2011
    Posts
    83
    Thank you. It works a dream!

    I just changed the "sterling" to "currency" and its fine.

    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •