Results 1 to 6 of 6
  1. #1
    Angate is offline Novice
    Windows 7 Access 2007
    Join Date
    Apr 2010
    Posts
    5

    Subform with Comboboxes

    I am using Access 2007 and am making a form that contains another form. The form contains information about a supervisor, and the sub form is a list of projects that supervisor has or is working on. I have 3 tables here, the supervisor table, the projects table, and an intermediate table relating supervisors to projects by ID. What I want is for the combo boxes to show the Project name rather than it's ID, and I don't want projects the supervisor is already assigned to to show up.



    I am having trouble with the combo boxes, If i make the project name visable, when i select one from the list, i get a prompt saying i did not select a valid project ID, and I have had no luck restricting the contents of the selection to those not already selected, I simply do not know where to draw the filter from the selected record of the main form.

    Here is the SQL for the Row Source of the combo box
    Code:
    SELECT Projects.ProjectName, Projects.ProjectID
       FROM Projects 
                   INNER JOIN ProjectSupervisors 
    		ON Projects.ProjectID = ProjectSupervisors.ProjectID
    WHERE (((ProjectSupervisors .ProjectID) Not In 
                    (SELECT ProjectSupervisors.ProjectID
    	        FROM ProjectSupervisors
                     WHERE SupervisorID = me.filter)));
    I also have the BoundColumn set to 2

    Ideas??

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What displays in a ComboBox is controlled by the Columns property and the ColumnWidth property along with the RowSource of course. A ColumnWidth of 0"; will not display. In your case you would want 0" as the 2nd column.

  3. #3
    Angate is offline Novice
    Windows 7 Access 2007
    Join Date
    Apr 2010
    Posts
    5
    I have the display set up just fine, the issue is that when I select from the combo box, i get the error:

    "Cannot add record(s); join key of table 'ProjectSupervisors' not in recordset"

  4. #4
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    WHERE (((ProjectSupervisors .ProjectID)
    You have a space before the .projectID. check to see if that's it.

  5. #5
    Angate is offline Novice
    Windows 7 Access 2007
    Join Date
    Apr 2010
    Posts
    5
    I get the same issue. I did address the me.filter and changed it to [Forms].[Form].[control].....

    What I believe the issue is is that the form's source is the supervisor table, and the sub forms source is the ProjectSupervisor and it is not finding where to put what or something?

  6. #6
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    me.cmbSupervisor (whatever you named the combobox that has it)

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

Similar Threads

  1. How to Reset Comboboxes
    By bbarrene in forum Programming
    Replies: 5
    Last Post: 01-23-2010, 11:11 PM
  2. Unable to retrieve data on Comboboxes
    By ditogui in forum Forms
    Replies: 8
    Last Post: 12-29-2009, 10:26 AM
  3. Cascaded comboboxes in a form
    By luca in forum Forms
    Replies: 2
    Last Post: 11-22-2009, 05:36 AM
  4. subform comboboxes/Textboxes
    By terryvanduzee in forum Forms
    Replies: 2
    Last Post: 11-19-2009, 07:41 PM
  5. Refreshing comboboxes in a subform
    By KB_Dev in forum Programming
    Replies: 1
    Last Post: 04-07-2009, 12:12 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