Results 1 to 4 of 4
  1. #1
    Csalge is offline Advanced Beginner
    Windows XP Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    31

    Combo value based on Query

    Hi.



    I have two combo boxes. Combo A and Combo B. Combo B pulls a query that picks case#s randomly based on selection on combo A. I was able to get the query to work and to display the value in combo B. However, the value stored in my table is the random ID #. I tried changing the properties in the table to a combo and setting the widths to 0" and 2" but it still only shows the ID#. Any suggestions?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Show properties of ComboB:

    RowSource
    ControlSource
    BoundColumn
    ColumnCount
    ColumnWidths
    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
    Csalge is offline Advanced Beginner
    Windows XP Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    31
    ROW SOURCE:
    SELECT TOP 1 tblProduction.[fk_productivity pointID], tblProduction.[Case Number], Rnd(tblemployee.[employeeID]) AS expr1, tblEmployee.EmployeeID
    FROM ([Employees Extended] INNER JOIN tblEmployee ON [Employees Extended].EmployeeID = tblEmployee.EmployeeID) INNER JOIN tblProduction ON tblEmployee.EmployeeID = tblProduction.fk_EmployeeID
    WHERE (((tblProduction.[fk_productivity pointID])=[Forms]![Performance Appraisal]![randomcombo1]) AND ((tblEmployee.EmployeeID)=[TempVars]![CurrentUserID]) AND ((tblProduction.DateofProductivity) Between [Forms]![Performance Appraisal]![StartDate] And [Forms]![Performance Appraisal]![EndDate]) AND ((tblProduction.Validation)=True))
    ORDER BY Rnd(tblemployee.[employeeID]) DESC;

    CONTROL SOURCE: element1case3

    BOUND COLUMN: 1

    COLUMN COUNT: 2
    COLUMN WIDTHS: 0"; 2"

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Darn, you have a TempVars variable in that query? Never used them.

    Far as I can tell ComboB should be saving the pointID value.

    Since you aren't showing the two employeeID fields in the combobox list because of the ColumnCount, no reason for them to be in the fields of the query, just uncheck the box below field in the query grid. The fields will still work in the WHERE and ORDER BY clauses.
    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. combo box query based on different query result?
    By mejia.j88 in forum Queries
    Replies: 10
    Last Post: 02-15-2012, 02:00 PM
  2. Query based on combo box
    By hawkins in forum Queries
    Replies: 10
    Last Post: 08-19-2011, 05:27 PM
  3. Replies: 10
    Last Post: 07-02-2011, 11:51 AM
  4. combo box based subform and query help required!!
    By crustycrab101 in forum Forms
    Replies: 3
    Last Post: 05-03-2011, 01:39 PM
  5. Running a query based on 2 combo boxes.
    By blessoni in forum Queries
    Replies: 4
    Last Post: 12-12-2010, 02:09 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