Results 1 to 4 of 4
  1. #1
    DXXPublic is offline Novice
    Windows 8 Access 2013
    Join Date
    Sep 2015
    Posts
    4

    Need help with click Event

    Im very new to MS Access and im working currently on a Task Management Database.

    Ok this is the structure im using

    Tables:


    tbl_Tasks
    tbl_Responsible
    tbl_Meetings
    tbl_updates

    Queries:
    qry_tasks

    Forms:
    frm_Summary
    frm_tasks_details
    frm_updates_subform

    Reports:
    rpt_Meetings
    rpt_Tasks

    ---------------------------

    My main form is the Summary Form (frm_Summary). Inside that form i have the 2 reports rpt_Meetings and rpt_Tasks.

    Information of rpt_Meetings is generated from the table tbl_Meetings and the report rpt_tasks is generated by the query qry_tasks.

    Visually it looks the way i want. But i want to be able to do the following:

    On the rpt_tasks (that is in frm_Summary) i want to be able to click the ID of the tasks (ID_task) and when click to open the frm_tasks_details and go to the task number i clicked

    On the report i add an event with this

    DoCmd.OpenForm "frm_Tasks", acNormal, "ID_task =" & [Reports]![rpt_Tasks]![ID_Task]

    When i do so get an error 2451.

    Now if i open the rpt_tasks directly and try it from there it works fine, but not when opening it from the frm_Summary.


    Anyone can give me some pointers on what am i doing wrong?


    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Can't reference the Reports collection because the report is not open as a report - it is an object contained within a subform/subreport container control. Reference the container control that holds the report.

    I always give container control a name different from the object it holds, like ctrTasks. Then code:

    & Me.ctrTasks!ID_Task
    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
    DXXPublic is offline Novice
    Windows 8 Access 2013
    Join Date
    Sep 2015
    Posts
    4
    Thanks a lot.

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Since you are admittedly new to Access, I'm going to suggest you work through a tutorial that will help you with every database you ever develop. Many who are new to Access jump right in to Access (believing all the marketing). From experience I can assure Access needs to work with a well designed database, and, a well designed database isn't automatic just because you're using Access. A well designed database is based on design concepts and this tutorial will help you, but you must work through it to get the experience.
    Good luck.

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

Similar Threads

  1. Replies: 13
    Last Post: 09-10-2015, 03:37 PM
  2. SubForm on Click event
    By raffi in forum Forms
    Replies: 8
    Last Post: 09-27-2014, 11:22 AM
  3. On click event script
    By VOLB in forum Programming
    Replies: 2
    Last Post: 02-21-2014, 03:44 PM
  4. On-Click Event Procedure
    By tbassngal in forum Forms
    Replies: 6
    Last Post: 07-20-2011, 07:06 AM
  5. On Click Event Procedure
    By MrDean in forum Forms
    Replies: 3
    Last Post: 10-07-2009, 07:16 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