Results 1 to 4 of 4
  1. #1
    dschmer is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Mar 2014
    Posts
    2

    Using value from a combo box in query of another combo box


    My goals is that I have a "Status" and a "Substatus" field in combo boxes on my form. I want the substatus query to limit the results based on the value in the Status field.

    I found this syntax on this forum for referencing the combo box
    [Forms]![frmDoSearch]![Combo0]

    I have this as my query. This "almost" works - however it seems that it is not getting the value of the cmbStatus field from the current record. It appears like it is looking only at the first record in my original form query. So if my first record had a status of "Open" - then my substatus lists only the Open substatus. I reversed the order of my query (out of curiosity) so the first record is Closed - then the substatus drop down list contains only closed values. What am I doing wrong?

    SELECT MIRFCodes.CodeId, MIRFCodes.Description, MIRFCodes.[Code Type], MIRFCodes.SubTypeOf
    FROM MIRFCodes
    WHERE (((MIRFCodes.[Code Type])=3) AND ((MIRFCodes.SubTypeOf)=[Forms]![FormMIRFMain]![cmbStatus]))
    ORDER BY MIRFCodes.Description;


    Thanks a million!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Fact of Life: dependent (cascading) combobox won't work nice in datasheet or continuous view if the combobox has lookup alias. This is because the property setting is reflected in all instances of the combobox as there is only one combobox and when the combobox is filtered it is filtered for all records and not all alias values are available.

    The only 'fix' I know is to include the lookup table in the form RecordSource with join type "Include ALL records from {primary table} and only those from {lookup table} that are equal."

    Bind textboxes to the lookup table fields and set them as Locked Yes, TabStop No.

    Size the combobox so only the dropdown arrow shows and sit it next to the locked textbox bound to the alias descriptor field.
    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
    dschmer is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Mar 2014
    Posts
    2
    Thanks for this reply. I'm a newbie/very occasional Access user so your fix is a little greek to me, but I'll try to walk through it. Thanks.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Ooops! Just tested and the reduced size of the combobox won't work.

    I've never had this issue so never fully tested. I was going by what I thought I've read. Unfortunately, now I can't remember what I read.
    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. Replies: 3
    Last Post: 07-03-2013, 10:38 AM
  2. Replies: 1
    Last Post: 10-30-2012, 10:29 AM
  3. Replies: 2
    Last Post: 08-16-2012, 10:02 PM
  4. Replies: 19
    Last Post: 08-25-2011, 10:54 AM
  5. Replies: 4
    Last Post: 08-16-2011, 05:54 PM

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