Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Garito100 is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Location
    Merseyside
    Posts
    18

    Adding a title to a report - but not in the normal way!

    Hi All,



    VERY new to Access here so need lots of help. I have a report set up called 'Signature List'. This is just a list of names with a blank box next to it for each person to sign for example of they have received a newsletter etc. I would like to add a title to this report but sort of on an Add Hoc basis. I was thinking of some sort of input box that pops up before the report opens and asks you what title you would like. I have an input box set up already but cannot get what I type in the box to appear as the title on the report. I imagine it's just getting it to point at a text box but I cannot get it to work. Anyone have any ideas?

    Thanks,
    Gary

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    To start with here is what I have done:

    I have a label on my report Label8. I have put this code on the OnOpen Event of my report. the input box pops up type the header and the it will be displayed in the label.

    Private Sub Report_Open(Cancel As Integer)
    Dim strHeader As String
    strHeader = InputBox("Type The Header")
    Me.Label8.Caption = strHeader
    End Sub

    if this solves your problem mark the thread solved.

  3. #3
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    Here's a brief explanantion on how to do this.

    1. Create an unbound text box on the form that you're using to access the report from, txtReportTitle.
    2. In your report. Create a label in the report header and call it lblCaption.
    3. In the report's On Open event use the below code.

    Code:
    Private Sub Report_Open(Cancel As Integer)
    Dim strCaption As String
    strCaption = Forms!frmReport!txtReportTitle
    Me.lblCaption.Caption = strCaption
    End Sub
    This will place what the users types in the text box on the form into the label on the report.

  4. #4
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    But Sir,

    I think Garito100 has already mentioned in his post that he is trying to put the header on to a Report using a InputBox.

  5. #5
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    Hi Maximus,

    Your post hadn't appeared yet when I was writing that or I wouldnt've posted it. Never hurts to have multiple options of doing things though.

    Quote Originally Posted by maximus View Post
    But Sir,

    I think Garito100 has already mentioned in his post that he is trying to put the header on to a Report using a InputBox.

  6. #6
    Garito100 is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Location
    Merseyside
    Posts
    18
    Thanks guys but I keep getting 'Object Required'. Here is a copy of my script:

    Private Sub Report_Open(Cancel As Integer)
    Dim strHeader As String
    strHeader = InputBox("Enter your title in the box below")
    SignSheet.Text11.Caption = strHeader
    End Sub

    SignSheet is the name of the report, Text11 is the box where the header should go.

  7. #7
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Private Sub Report_Open(Cancel As Integer)
    Dim strHeader As String
    strHeader = InputBox("Enter your title in the box below")
    Me.Text11 = strHeader
    End Sub

    try this.

  8. #8
    Garito100 is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Location
    Merseyside
    Posts
    18
    It still says Object Required.

  9. #9
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Using Report Names while referring to an object in the report:
    Reports!ReportName!TextBoxName

    Private Sub Report_Open(Cancel As Integer)
    Dim strHeader As String
    strHeader = InputBox("Enter your title in the box below")
    Reports!SignSheet!Text11 = strHeader
    End Sub


    caption property is used with Labels and not with TextBoxes.

  10. #10
    Garito100 is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Location
    Merseyside
    Posts
    18
    Now I get 'You can't assign a value to this object'.

  11. #11
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Check out this sample

  12. #12
    Garito100 is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Location
    Merseyside
    Posts
    18
    Maximus, your example does the same. I get 'You can't assign a value to this object'

  13. #13
    Garito100 is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Location
    Merseyside
    Posts
    18
    I don't know if this changes things but I just want to click on a button - a box pops up asking me if I want a title or not. If yes, a second box pops up asking me to enter the title and then my report prints with this title on the top of the page. Otherwise if I click no the report prints with no title. I don't want it to be stored or saved anywhere, just simply printed on the top of the report.
    (I'm sorry to be a pain!!)

  14. #14
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    Try making the the report title for your report a label instead of a text box. lblCaption is the name of the label that will contain the user input. So with the code you're using do this.

    Code:
    Dim strHeader As String
    strHeader = InputBox("Enter your title in the box below")
    Me.lblCaption.Caption = Nz(strHeader)
    Quote Originally Posted by Garito100 View Post
    I don't know if this changes things but I just want to click on a button - a box pops up asking me if I want a title or not. If yes, a second box pops up asking me to enter the title and then my report prints with this title on the top of the page. Otherwise if I click no the report prints with no title. I don't want it to be stored or saved anywhere, just simply printed on the top of the report.
    (I'm sorry to be a pain!!)

  15. #15
    Garito100 is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Location
    Merseyside
    Posts
    18
    Still says Object Required

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 05-22-2010, 08:30 PM
  2. Title Label In Subforms
    By vCallNSPF in forum Reports
    Replies: 4
    Last Post: 12-08-2009, 06:20 PM
  3. Replies: 0
    Last Post: 06-14-2009, 06:18 PM
  4. Problems adding a drop down box to report/query
    By rachelm920 in forum Access
    Replies: 1
    Last Post: 05-14-2009, 09:19 AM
  5. Adding rows on cross-tab query report
    By KahluaFawn in forum Reports
    Replies: 2
    Last Post: 02-18-2009, 10:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums