Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397

    Unanswered: Reprt Question --- Urgent help need...

    Hi,

    In a unbound textbox named TxtSR on report I placed following code.

    =IIf([Page]<[Pages],Null,[SecondAmt])

    Report is based on simple query that receives data from table upon open.

    The purpose is to display data (SecondAmt) only at last page and all the previous pages should be null. It works fine but even I dont border of this unbound textbox to display in all the previous pages.

    To do so, I also put code in on activate event of the report as follows:

    Private Sub Report_Activate()
    Dim x As Boolean
    x = True
    Dim INGBLK As Long, INGWHT As Long
    'y = 20
    INGBLK = RGB(0, 0, 0)
    INGWHT = RGB(255, 255, 255)

    If Not IsNull(TxtSR) Then
    Me.TxtSR.Visible = True
    Me.TxtSR.BorderColor = INGBLK
    Else
    Me.TxtSR.BorderColor = INGWHT
    Me.TxtSR.Visible = False
    End If
    End Sub

    Off course it dont display data except last page but Border which I dont want on all previous pages.

    Any idea?

    With kind regards,
    Ashfaque

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Perhaps you can put SecondAmt on a report footer?
    This will only display at the end of the report (i.e. the last page).

    If not - where are "Page" and "Pages" set/declared?

    - GeorgeV
    George
    Home | Blog

  3. #3
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    Thanks for the reply.

    If I put SecondAmt on report footer then it would not appear exactly below the FirstAmount (another textbox) which calculate (cumulative data from one page to another page). Bcs FirstAmt is placed in page footer. I need SecondAmt exactly after my FirstAmt. Hence only I need to make this invisible.

    Regards,
    Last edited by Ashfaque; 01-31-07 at 05:46.

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Where are Page and Pages declared?

    If I can get your if statement to work I can have a go at making a change for you.

    Perhaps post the *.mdb file with the query + report combo.

    - GeorgeV
    George
    Home | Blog

  5. #5
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    Here it is...

    Pls run form "EXPORT INVOICE" and go to invoice # 10026. The amount is set in US$. Once it appears US$, it would convert in SR @ of 3.75 and will insert value in another box which is automated. But it main amount is not in Dollers the second amount will disappear automatically from report.

    The main thing is if the report is more than a page then the converted amount should appear on last page only....

    Hopefully I explained in a simple way.

    Regards,
    Ashfaque

    ps. the db is with minimum objects and data.
    Attached Files Attached Files

  6. #6
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Ok, discovered why it's not working for you.
    1) You have the code on "Report_Activate()" which only runs when it i first displayed - Look at what other events you can use.
    2) "Page > Pages" will never occur, you want "Page = Pages"
    3) Why are you using variabls to assign "RGB(0,0,0)" when you could so easily type in "Me.TxtSR.BorderColor = RGB(0, 0, 0)"

    Keep it simple!
    I have a working solution if you can't work out what to do from here, but this should hopefully sort you out!

    - GeorgeV
    George
    Home | Blog

  7. #7
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    The idea # 2 & 3 is ok. I even changed the event (used Open event)

    BUT DOES'NT WORK.

    If it works with you after changes, can u please upload it here ?

    Regards,

  8. #8
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Try Report_Page()

    I can't seem to find the changes- I saved them in a .txt somewhere :P

    Will try knock it up for you when I have another spare 5minutes.


    - GeorgeV
    George
    Home | Blog

  9. #9
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    Try Report_Page()
    Already tried...No luck..

    Regards,

  10. #10
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Code:
    Private Sub Report_Page()
    If Page = Pages Then
        Me.TxtSR.BorderColor = RGB(255, 255, 255)
    Else
        Me.TxtSR.BorderColor = RGB(0, 0, 0)
    End If
    End Sub
    - GeorgeV
    George
    Home | Blog

  11. #11
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    Thanks for reply but sorry to say....still border is apprearing on first page.

    Any other idea ?

    Regards

  12. #12
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I will have another go a this tonight but that code worked more than fine when I ran it on your report.

    EDIT: Just a thought
    Access sometimes (mostly) ignores subs that are not declared via the form/report properties.
    Open the report and find the event and click the ... button. Then copy the code in!
    Let me know if this works please!
    Last edited by gvee; 02-05-07 at 07:23.
    George
    Home | Blog

  13. #13
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    If you make the text box "TxtSR" as Visible=False in design view, then you can use:
    If Page=Pages Then
    TxtSR.Visible = True
    End If

  14. #14
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    Thanks GolferGuy.

    Your idea worked out !!! Only I replaced logical operator keeping TxtSR visible false initially.

    If Page<Pages Then
    TxtSR.Visible = True
    End If

    Now I reached upto 80% n I can play with it. I will let u knoe when I reach 100%.

    I also thanks to georgev for his valuable efforts.

    Thank you very much gentlemen.

    With kind regards,
    Ashfaque
    Last edited by Ashfaque; 02-06-07 at 02:30.

  15. #15
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    Yeah,

    Its 100% ok now...What I did on the report is; I placed data field as control source of TxtSR instead of =IIf([Page]<[Pages],Null,[SecondAmt]). And placed following code report page event as follows

    Private Sub Report_Page()
    If Page < Pages And Not IsNull(TxtSR) Then
    TxtSR.Visible = True
    ElseIf Page < Pages And IsNull(TxtSR) Then
    'do nothing as TxtSR is visible false initially
    End If
    End Sub

    It worked out !!

    With kind regards,
    Ashfaque

Posting Permissions

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