Page 10 of 16 FirstFirst 12345678910111213141516 LastLast
Results 136 to 150 of 238
  1. #136
    Etoimos is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Mar 2020
    Posts
    249
    Another question for you guys regarding the PDF output file. I've naming the file 99% the way I want it to with this code:

    Code:
    DoCmd.OutputTo acOutputReport, "DSR_rpt", "PDF Format (*.PDF)", "\\one.mda.mil\Public\OPIR\Lab Ops (Formerly TSC)\Test Events\DSR Library\" & Format (Me.Event) & Format(Me.DSRLab) & "_" & Format(Me.DSRExecutionDate, "YYYY_MM_DD") & "_" & "DSR" & ".pdf", True
    I'd like have the name of the event in the file name, but I don't have the event name on that form (it is in the DSR_rpt). How can I add the Event name to the file name when it is not in the form since I can't use Format(Me.Event)? I tried using Format (DSR_rpt.Event) and that did not work. I imagine that is because the report is be generated at the same time as the PDF so it does not know what DSR_rpt is yet.

  2. #137
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Are you sure the combos return the event name and the execution date? Meaning are the bound columns in each the event and date or is it something else (eventID)?
    Also for the DSR_frm can you change its source to just "SELECT ExecutionDate, Event FROM RunResultData;".

    Cheers,
    Vlad
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #138
    Etoimos is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Mar 2020
    Posts
    249
    Quote Originally Posted by Gicu View Post
    Are you sure the combos return the event name and the execution date? Meaning are the bound columns in each the event and date or is it something else (eventID)?
    They do return the event name and date and not something like an eventID.

    Quote Originally Posted by Gicu View Post
    Also for the DSR_frm can you change its source to just "SELECT ExecutionDate, Event FROM RunResultData;".
    I made this change and it did not seem to effect anything, so I'm guessing the answer is yes. What does this do for me though?

  4. #139
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Can you please post a stripped version with the two forms and the table?

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #140
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    As for the previous question you can use dLookup to get the event name to be used in the file name:
    Dim sEventName as string
    sEventName =dlookup("[Event]","[YourEventTable]","EventID]=" & Me.EventID)
    'now use the sEventName variable for the file name

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  6. #141
    Etoimos is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Mar 2020
    Posts
    249
    Quote Originally Posted by Gicu View Post
    Can you please post a stripped version with the two forms and the table?

    Cheers,
    I'll try and do this tonight, I'm back in the office now and I can't upload files from their network.

    Quote Originally Posted by Gicu View Post
    As for the previous question you can use dLookup to get the event name to be used in the file name:
    Dim sEventName as string
    sEventName =dlookup("[Event]","[YourEventTable]","EventID]=" & Me.EventID)
    'now use the sEventName variable for the file name

    Cheers,
    Would the Dim sEventName code be part of the OnClick for the button, or where would that go? And does the Me.EventID not require it to be on the form?

  7. #142
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Yes, it should be just prior to the docmd.outputto in the OnClick event. You must have some way on the form to identify the event to be be included in the report, use that same criteria for the dlookup.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  8. #143
    Etoimos is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Mar 2020
    Posts
    249
    Quote Originally Posted by Gicu View Post
    Yes, it should be just prior to the docmd.outputto in the OnClick event.


    Thanks, I'll give that a shot.


    Quote Originally Posted by Gicu View Post
    You must have some way on the form to identify the event to be be included in the report, use that same criteria for the dlookup.
    I'm using the ExecutionDate drop down that we built earlier in this thread that has the date, event and run number in it's three columns. I did try using
    Code:
    & Format(Me.DSRExecutionDate.Column(1) 
    But that did not work either.

    Also, messing around with the DSR_frm more, changing the
    source to
    "SELECT ExecutionDate, Event FROM RunResultData;" did mess it up. It made it where I could not actually make a selection in the
    ExecutionDate drop down.

  9. #144
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Please upload what you have right now when you can and I'll have a look. Just as a note, you don't need to use Format() for the event name (Event) or DSR_Lab, in my original example I used on the date field to format it in a certain way (in your post above you are missing a bracket at the end), it should just be
    Code:
    & Me.DSRExecutionDate.Column(1) &
    Cheers,
    Vlad
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  10. #145
    Etoimos is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Mar 2020
    Posts
    249
    Okay, here is the current stripped version.

    EED Stripped 11.zip

  11. #146
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Please have a look, it looks you only have one "event" per day, you would need to change the design if that changes (both for the naming and for the report's record source itself).

    Cheers,
    Attached Files Attached Files
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  12. #147
    Etoimos is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Mar 2020
    Posts
    249
    Thanks Vlad, that did get the file name sorted out. It is possible that we will have more than one Event per day, but the Events would be different, FTM-44, GTI-20, GTD-10 ect.

  13. #148
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Yes, and that is the problem, the report will include them all (as the only criteria is the date) and the report name will contain only the first event. I suggest you revised the form and report to include the event in the criteria.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  14. #149
    Etoimos is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Mar 2020
    Posts
    249
    Quote Originally Posted by Gicu View Post
    Please have a look, it looks you only have one "event" per day, you would need to change the design if that changes (both for the naming and for the report's record source itself).

    Cheers,
    Did you happen to notice what is causing my Search DSR button to not open the relivent DSR?

  15. #150
    Etoimos is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Mar 2020
    Posts
    249
    Quote Originally Posted by Gicu View Post
    Yes, and that is the problem, the report will include them all (as the only criteria is the date) and the report name will contain only the first event. I suggest you revised the form and report to include the event in the criteria.

    Cheers,
    So would I add a combobox to the form for the Event like I already have for the date? Or should I do a seperate form that contains the Event and Date comboboxes that then open up the form to be filled out?

    Or perhaps a single DSR form that allows them to select the Event and Date, but with two buttons on it. One to create a new DSR and one to open an previous DSR for review?

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

Similar Threads

  1. Replies: 4
    Last Post: 10-13-2014, 09:20 AM
  2. Replies: 6
    Last Post: 02-19-2014, 11:11 AM
  3. Replies: 3
    Last Post: 07-03-2013, 10:38 AM
  4. Replies: 1
    Last Post: 10-30-2012, 10:29 AM
  5. Replies: 1
    Last Post: 07-11-2012, 08:36 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