Results 1 to 8 of 8
  1. #1
    cardgage is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2011
    Posts
    50

    Error when trying to open form with specific record from subreport (can't find field)

    Hello all,

    As the title suggests, I am trying to open a form "frmTaskInfo" containing a specific record (primary key = "TaskID") when double-clicking on the "TaskDesc" field on a subreport "sbrptTodoList". Here is the code I am using:

    Code:
    Private Sub TaskDesc_DblClick(Cancel As Integer)
    
      DoCmd.OpenForm "frmTaskInfo", _
        WhereCondition:="TaskID=" & Me.TaskID
    
    End Sub
    When I double-click on the TaskDesc field, I get the error, "Microsoft Access can't find the field 'TaskID' referred to in your expression." I had programmed this with a command button on a subform with success, however I was not able to format the continuous subforms to my liking. This same function should be possible from a subreport, no? I have included an image of my SELECT query for sbrptTodoList in case that is helpful.

    Any help will be greatly appreciated!


    cardgage
    Attached Thumbnails Attached Thumbnails Subreport SELECT query.PNG  

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Set a breakpoint so you can hover over the "Me.TaskID" to see if it has a value. We're trying to see if it can't find the field on the subreport or the form being opened. Can you attach the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    cardgage is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    50
    Thank you for the reply. I set a breakpoint and when I hover over the statement is says that access can't find TaskID. I have attached a clean version of the database as well.dbReportError.zip

  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,518
    TaskID is in the query but not on the report. Put a textbox named TaskID bound to that field in the detail section (it can be hidden). Then your code works fine.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    when double-clicking on the "TaskDesc" field on a subreport "sbrptTodoList".
    I don't see a TaskDesc on the subform/report????
    Perhaps you could tell us about the "business" this database is intended to support.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Already solved, but it's a control name not a field name. The field is TascDescEllipsis.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    cardgage is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2011
    Posts
    50
    Quote Originally Posted by pbaldy View Post
    TaskID is in the query but not on the report. Put a textbox named TaskID bound to that field in the detail section (it can be hidden). Then your code works fine.
    Thank you pbaldy, that worked perfectly!

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 3
    Last Post: 11-28-2016, 03:17 PM
  2. Find specific record in subreport
    By hpHHI in forum Reports
    Replies: 1
    Last Post: 05-24-2013, 03:14 AM
  3. Open form to specific record, error 3070
    By msleelee in forum Access
    Replies: 3
    Last Post: 02-17-2013, 03:05 PM
  4. Replies: 5
    Last Post: 03-03-2011, 03:56 PM
  5. Replies: 4
    Last Post: 07-22-2009, 02:33 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