Results 1 to 5 of 5
  1. #1
    jhrBanker is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2009
    Posts
    68

    Base Combobox values on another form control

    I have a Combobox control (StatCD) on a form (frmProjectMaint)for Project Status based on a “Status” table. I also have a field on the form which contains the Project End Date (“EndDT”). If the project has an end date (ie; Is Not Null), I want the Combobox values to only display the table values “On-Hold, Completed, Killed, No GL Impact or RGFO Completed”(TermDtReq=Y). However, if there is no EndDT, I want Combobox values to only display the table values “Active or Not Started”(TermDtReq Is Null).

    Can I accomplish this by modifying the Combobox Row Source SQL?
    Row Source: SELECT [Status].[StatCd], [Status].[Status] FROM [Status] ORDER BY [Status];

    Form: frmProjectMaint (based on qryProjectsMaint)
    Field: EndDT
    CB: StatCD

    Table: Status
    StatCD Status TermDtReq
    1 Active
    2 On-Hold Y
    3 Completed Y
    4 Killed Y
    5 Not Started
    6 No GL Impact Y
    7 RGFO Completed

    Thanks

    Using Access 2007 with mdb db

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    Have you found a solution to this?
    I think you should be able to do so with adjusting the row source and a requery.
    Just looking at your sql ---Im surprised that Access isn't confused with the various usages ofstatus.

  3. #3
    jhrBanker is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2009
    Posts
    68
    No, I have not gotten an answer yet. I don't know how to modify the SQL query in the row source to accomplish my goal.

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    In theory/conceptually you need some sql to populate the row source of the combo, and depending on the value of Project End Date (“EndDT”) in the current record. (---------------------untested air code--------------------------- )
    Code:
         If  IsDate(endDt) = True then
      me.comboname.rowsource = "SELECT  [Status].[StatCd], [Status].[Status] FROM [Status] " _                                            & "WHERE trmdtReq = 'T' ORDER BY [Status];" 
     else 
    me.comboname.rowsource = "SELECT  [Status].[StatCd], [Status].[Status] FROM [Status] "                                             & "WHERE trmdtReq  'T' ORDER BY [Status];"  
    End If
    Note: I don't know if it's just me or the forum, but I can not edit properly; doesn't respect crlf can not edit the code within code boxes and have lost all the editing tools!!!!
    Last edited by orange; 03-20-2015 at 05:22 PM.

  5. #5
    jhrBanker is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2009
    Posts
    68
    Thanks. I'll give it a try

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

Similar Threads

  1. Replies: 18
    Last Post: 04-16-2014, 11:45 AM
  2. Form combobox won't bring up values
    By sevanty7 in forum Access
    Replies: 7
    Last Post: 05-17-2013, 11:45 AM
  3. Combobox control for linked form/subform
    By Dbusse706 in forum Access
    Replies: 2
    Last Post: 07-03-2012, 07:49 PM
  4. Replies: 5
    Last Post: 06-10-2011, 03:31 PM
  5. Replies: 1
    Last Post: 03-24-2010, 08:42 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