Results 1 to 2 of 2
  1. #1
    jackiea is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2011
    Posts
    1

    Problem with Code

    I am trying to use the following code on the Click Event to filter one subform from another. It is working except for the fact that a parameter box pops up with the Report ID that I clicked on. If I type in the Record ID, then the filter works. I do not want to have this parameter box pop up. Please let me know what needs to be changed for this not to happen. Note that my field Report ID has a space. I am wondering if this is the reason. Thanks in advance.



    Private Sub REPORT_ID_Click()
    Forms![Top Defects]![tbl_Inspection_Results subform1].Form.Filter = "[REPORT ID] = " & Me.[REPORT ID]
    Forms![Top Defects]![tbl_Inspection_Results subform1].Form.FilterOn = True
    End Sub

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    As long as names with spaces, special characters, punctuation (underscore is exception) or are reserved words are enclosed with [], should work. Which is why is a good idea not to use those features in names - have to remember the []s.

    Never tried to control filter of a subform from another subform.

    What works for me is to refer to the container control. I always give the container a name different from the object it holds. Example: Forms![Top Defects].ctrNameHere.Form.Filter =

    A subform container SourceObject can be a table, query, form, report. All of my subform containers have a form or report as SourceObject. You reference a table name but is the SourceObject actually a form?
    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.

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

Similar Threads

  1. Code Problem
    By Jeddell in forum Programming
    Replies: 2
    Last Post: 09-29-2011, 06:31 PM
  2. Problem with INSERT INTO query code
    By rghollenbeck in forum Queries
    Replies: 8
    Last Post: 09-27-2011, 12:16 PM
  3. Alert Message Code Problem
    By 10 Gauge in forum Forms
    Replies: 1
    Last Post: 03-15-2011, 12:17 PM
  4. Access 2010 - Error Code 438 Problem
    By Lexus350 in forum Access
    Replies: 5
    Last Post: 03-03-2011, 11:46 PM
  5. Problem with Code
    By cujee75 in forum Programming
    Replies: 0
    Last Post: 03-10-2006, 02:40 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