Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    revolution9540 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Posts
    18
    Quote Originally Posted by June7 View Post
    That tutorial is a well-used example of a search utility.

    Exactly how is the combobox used to filter subform records? Dynamic parameterized query (I NEVER use them) or code that applies criteria to form Filter property (you don't show any such code) as in the referenced tutorial?

    If you want to provide db for analysis, follow instructions at bottom of my post.
    I have literally posted every line of code I used. Info in this database is classified, so I can't post it unfortunately. However, here is a detailed breakdown of it:

    Tables: Desktops, Laptops, Printers, Users
    Forms: SearchForm, MainForm

    SearchForm:
    The unbound combobox named Combo25 allows the user to type the last name of a user or select from a list of all users in the Users table. In the properties for Combo25, Row Source has the following code:


    Code:
    SELECT Users.Username, Users.[Last Name], Users.[First Name], Users.Department FROM Users ORDER BY Users.[Last Name], Users.[First Name], Users.Department, Users.Username;
    Row Source Type for Combo25 is "Table/Query".

    In Properties\Events for Combo25, [Event Procedure] is listed in After Update. Clicking on the ... shows this code:
    Code:
    Private Sub Combo25_AfterUpdate()Me.Requery
    End Sub
    Fields in SearchForm like Last Name, First Name, Employee ID, etc populate based on the selection from the list of users in Combo25.

    Then I created a new form called MainForm which I hope to have many forms with the same function as SearchForm. I create a Tab Control object in a blank form and drag SearchForm directly into that tab. I then am immediately prompted with the message in the picture shown in the original post. I can hit OK and then see the SearchForm embedded in MainForm, but if I go to Form View or Layout View and try to use the combo box in the embedded SearchForm, it will not populate any fields and will display this error message:

    Click image for larger version. 

Name:	Capture.PNG 
Views:	5 
Size:	5.3 KB 
ID:	21429

    Clicking "Debug" brings us to the image I posted in Post #10. It appears to me that Me.Requery, is causing the problem. Maybe MainForm is is taking Me as itself? I have no idea. I do appreciate the help though.

  2. #17
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Just selecting a user from combobox does nothing to filter records of subform. The selected value must be used somewhere. Commonly this is either a dynamic parameterized query or the VBA example in the Allen Browne link.

    The Me.Requery accomplishes nothing unless the form RecordSource is a dynamic parameterized query (review http://datapigtechnologies.com/flash...tomfilter.html). Show the form's RecordSource SQL statement.

    Can copy db and remove confidential info (names, addresses, phone, email, ssn) or remove all data and include some dummy records for testing purposes.
    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.

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

Similar Threads

  1. Replies: 5
    Last Post: 12-09-2014, 02:38 PM
  2. Replies: 4
    Last Post: 11-06-2014, 05:35 AM
  3. Replies: 12
    Last Post: 10-23-2014, 02:08 AM
  4. Reference Subform on Navigation Form
    By GOP in forum Forms
    Replies: 1
    Last Post: 07-30-2014, 08:18 AM
  5. Navigation Form used as SubForm
    By jlgray0127 in forum Forms
    Replies: 2
    Last Post: 03-26-2014, 10:28 AM

Tags for this Thread

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