Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Matce is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2022
    Posts
    7

    opening report2 from report1 at a specific spot

    Hello everyone,
    I am a complete 100% rookie here - ZERO clue about programming in access, etc... just made a simple db to manage some devices but really need one specific feature to be somewhat efficient.

    On this report here, I'd like to double-click on a specific record in report a (picture 1) and then open a 2nd report (see picture 2) but ONLY showing everything on the Panel (in this example "E") that is marked when I double-clicked.
    I currently get a message-popup where I need to enter the Panel-ID (a, b, c, d, e or f) to get the proper result. My macro is obviously wrong and not gathering the Panel-Information from the double-click location ... if that makes any sense!?







    thanks!

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Without the actual code\macro that you have in the double-click event of the control we cannot help you much with just the two screen shots. For VBA you should look at docmd.openreport and using the Where condition to restrict the records accordingly.

    And just as a side note, reports are usually meant for displaying info not interacting with it; maybe a form could replace the first report as the "starting point" for you final target which seems to be the second report.

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

  3. #3
    Matce is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2022
    Posts
    7
    Quote Originally Posted by Gicu View Post
    Without the actual code\macro that you have in the double-click event of the control we cannot help you much with just the two screen shots. For VBA you should look at docmd.openreport and using the Where condition to restrict the records accordingly. And just as a side note, reports are usually meant for displaying info not interacting with it; maybe a form could replace the first report as the "starting point" for you final target which seems to be the second report. Cheers,
    I dont have VBA, etc - I just used the "dblclick" on the access-macro-thingy... https://i.ibb.co/p2DcM09/Report3.jpg

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Post 3 was moderated, I'm posting to trigger email notifications.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    I don't use macros much as I find VBA much more flexible and powerful but you might try removing the [ControlSource] part.

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

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,933
    Quote Originally Posted by Matce View Post
    I dont have VBA, etc - I just used the "dblclick" on the access-macro-thingy... https://i.ibb.co/p2DcM09/Report3.jpg
    Probably need more like this? Not sure a macro recognises Me ?

    I would start learning VBA. Macroes are quite limited. I only use them for batch processes. However if you have to use them, then use the builder for the correct syntax.

    HTH
    Attached Thumbnails Attached Thumbnails macro.PNG  
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #7
    Matce is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2022
    Posts
    7
    Quote Originally Posted by Gicu View Post
    I don't use macros much as I find VBA much more flexible and powerful but you might try removing the [ControlSource] part.Cheers,
    I tried... I tried about every possible combination that would make any sense in my head lolHow do I do the VBA ? Could you tell me what the code is to make this happen? That's really all I need... click on the line in Report 1 and then it opens Report 2 to see all the other units on the same Panel (that way I know whether the panel is out or just a single unit).thanks

  8. #8
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,933
    Just tested and even an embedded macro does not like Me. or Me!
    Use the full form name and control name each time.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  9. #9
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    In the AfterUpdate event of the Panel textbox on the first report select [Event Procedure] and inside the body of the procedure add

    Code:
    Docmd.OpenReport [Breakers Sorted],acViewReport,,"[Panel ID] ='" & Me.Panel & "'"  'this assumes the field name in the record source is called "Panel ID" and you named the textbox bound to it "Panel" on the first report - adjust accordingly to match your names
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  10. #10
    Matce is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2022
    Posts
    7
    Quote Originally Posted by Gicu View Post
    In the AfterUpdate event of the Panel textbox on the first report select [Event Procedure] and inside the body of the procedure add

    Code:
    Docmd.OpenReport [Breakers Sorted],acViewReport,,"[Panel ID] ='" & Me.Panel & "'"  'this assumes the field name in the record source is called "Panel ID" and you named the textbox bound to it "Panel" on the first report - adjust accordingly to match your names
    Cheers,
    appreciate the info... I tried to copy and paste this but I'm getting an error when executing it...

    Screenshot here:
    contains error message
    the names of the fields
    the code I copy and pasted



    thanks!

  11. #11
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Sorry, the report name should be enclosed in double quotes:
    Docmd.OpenReport "[Breakers Sorted]",...
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  12. #12
    Matce is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2022
    Posts
    7
    Quote Originally Posted by Gicu View Post
    Sorry, the report name should be enclosed in double quotes:
    Docmd.OpenReport "[Breakers Sorted]",...
    almost there I think lol

    now I'm getting this error:



    Definitely not misspelled (double checked) and I don't know what the property-thing means

  13. #13
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    just try it without the square brackets (you should not have spaces in the field or object names).

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

  14. #14
    Matce is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2022
    Posts
    7
    Quote Originally Posted by Matce View Post
    almost there I think lol

    now I'm getting this error:



    Definitely not misspelled (double checked) and I don't know what the property-thing means
    ALL GOOD!

    It's "Breakers sorted" - no brackets. Works!!!

    Is there any way to HIGHLIGHT the spot in the new report that corresponds to the Me.MinerDetail in report 1?

  15. #15
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    It would be if you were using forms, not sure about the reports. To "highlight' the record would mean to select it and to do that you would need to tell it what to look for (the MinerDetail or better the MinerID value). You could do that by using the OpenArgs parameter of the Docmd.OpenReport method you are using to open it (it is the last one):
    Code:
    'Docmd.OpenReport (ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs)
    Docmd.OpenReport "Breakers Sorted",acViewReport,,"[Panel ID] ='" & Me.Panel & "'",,Me.MinerID
    Then in the Open event of the second report try to navigate to that record"
    Code:
    'use SearchForRecord 
    Docmd.SearchForRecord acDataReport, Me.Name, , "[MinerID]=" & Me.OpenArgs
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Replies: 9
    Last Post: 12-13-2016, 03:06 PM
  2. Help please code for opening a specific file
    By tuniwes in forum Programming
    Replies: 3
    Last Post: 03-13-2016, 05:46 PM
  3. Open Report2 if field is empty
    By cofeman in forum Reports
    Replies: 9
    Last Post: 08-24-2015, 03:00 PM
  4. Replies: 5
    Last Post: 01-24-2015, 12:59 AM
  5. Replies: 2
    Last Post: 04-21-2012, 04:10 PM

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