Results 1 to 11 of 11
  1. #1
    BStortz is offline Novice
    Windows 11 Office 365
    Join Date
    May 2025
    Posts
    12

    Create a custom header upon opening a report

    Hi all,

    I am creating a database from scratch for a home business for sales. I would like that when I open a report that is for a new client on the fly I can input the header custom as I open it. Basically, I have an "add item" box in the main table that populates a query that the report is based off then when I open the report I would like it to add the clients name. The potential client wouldn't be in the system yet so I would like it to ask me what the first, last is and it populates the header.



    Better yet if I could do it off of a form so it does enter the name of the client into the database at the same time as opening the form that'd be great.

    I have looked up online about how to do this and I forgot how (did database work like two decades ago and forgot how the code works so now when I look at it it is like gibberish to me).

    Any insight, where to read up, or help is very appreciated.

    Thanks,

    BStortz

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    If you want the name entered into database, exactly what is the issue? Create record on form, commit to table, open report filtered for that client. A button on form could have code like:
    Code:
    If Me.Dirty Then Me.Dirty = False
    DoCmd.OpenReport "report name here", acViewPreview, , "ClientID=" & Me.ClientID
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    BStortz is offline Novice
    Windows 11 Office 365
    Join Date
    May 2025
    Posts
    12
    I see what you are saying and know about that just was overthinking something that is actually relatively simple trying to do it all off the report which didn't make sense to me since adding to the DB is not a report function but a form one. I could just run the form to enter the data then use the query attached to the report to pull the info. Simple enough.

    Unless you think there is a better way.

    Thanks

  4. #4
    BStortz is offline Novice
    Windows 11 Office 365
    Join Date
    May 2025
    Posts
    12
    Actually, I think I am overthinking this. Its been over twenty years since I have done anything with databases but I remember a way to have an "unbound" area that is not connected to anything but does ask to be filled in. That is what I need.

    I made a new form for the client and prospective client lists so that isn't an issue. This is more of making a quick on the fly custom report just with the prospective clients info in real quick without entry into the DB.

    Thanks again

  5. #5
    madpiet is offline Expert
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    565
    So where is your question?

    you could create a query that points to an open form where the users fills in the form to collect options, and then you can display that on the report... you'd just have to point to the open form's controls

  6. #6
    BStortz is offline Novice
    Windows 11 Office 365
    Join Date
    May 2025
    Posts
    12
    Again, I guess I do not know how to word this correctly. It does seem very simple to me. I just need a header that is unbound that when I open the rpt it asks what nameI need for the header. The name is just for the header. Something I do not have to go into the design each time to update. If that is the only workaround then so be it but I know there is a way that when you click on the report it will ask for the information and then open the report with it there. The report is connected to a checklist of items but the client is not in the database as of yet. Just a quick list of items and customized name of the client for the header.

  7. #7
    davegri's Avatar
    davegri is offline Excess Access
    Windows 11 Access 2021
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,740
    Add a textbox in the report header named rptHeader. Add this event to the report:

    Code:
    Private Sub Report_Load()
        Me.rptHeader = InputBox("Prospect Name")
    End Sub
    Code gives you this:
    Click image for larger version. 

Name:	emmaInput.png 
Views:	20 
Size:	19.0 KB 
ID:	53067

    and so:
    Click image for larger version. 

Name:	emmaheader.png 
Views:	20 
Size:	8.0 KB 
ID:	53068

  8. #8
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,422
    Why not just put potential clients in the same table and use 2 date fields to handle their status? One for active, the other for inactive. Then base your report on that. If you want to see potentials, both dates are null. For active, Inactive is null, etc.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  9. #9
    BStortz is offline Novice
    Windows 11 Office 365
    Join Date
    May 2025
    Posts
    12
    I understand what you are saying but I have to create a report pretty much immediately with little information. Eventually the clients databse will be removed completely due to security. I do not want personal information in the same area as product information so I am trying to set it up where relatively soon when it isn't just myself and my partner it is already separated. I am currently trying to get the above code to work but haven't been able to do so but have only tried once.
    Unless I am missing something. This sucks because I knew all of this twenty years ago lol.

  10. #10
    BStortz is offline Novice
    Windows 11 Office 365
    Join Date
    May 2025
    Posts
    12
    Working on this now. Tried once and failed but it seems pretty basic especially since you gave the code.
    Very appreciate it and will update in a few if i figured it out.

  11. #11
    BStortz is offline Novice
    Windows 11 Office 365
    Join Date
    May 2025
    Posts
    12
    Awesome! Worked great! Just had to rename the text box that is where I was lost lol.

    Thanks again!!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 09-05-2022, 11:42 AM
  2. Replies: 3
    Last Post: 12-01-2017, 12:52 PM
  3. Create a popup form upon opening ACCESS
    By johnseito in forum Forms
    Replies: 15
    Last Post: 08-07-2017, 07:44 PM
  4. Replies: 3
    Last Post: 12-29-2015, 04:06 PM
  5. Replies: 3
    Last Post: 05-30-2014, 12:34 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