How to allow a combo box result to be left blank after using has clicked the box.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wordbrew
    New Member
    • Oct 2009
    • 29

    How to allow a combo box result to be left blank after using has clicked the box.

    This is just a weird nuisance that corrects itself if the user selects a value from the dropdown list, but I want to allow for the user not selecting something in the dropdown list, perhaps they look at their options but then click in a different field to start working on something else, without actually having chose something.

    Ok, I have a subform (which is in datasheet view) on which are two fields fldAlbumLookup_ com and fldSongsLookup_ com. If an album is selected from the first field, then the second field populates with song choices only from the album selected via a query qrySongs, with the qrySongs having the criteria [Forms]![frmCommissions]![frmCommissionsS ubform]![fldAlbumLookup_ com].

    This works great, but as I said, if they say, choose Weezer as the Album, and they click on the song field and see the song choices, which now only populate with Weezer songs, but for whatever reason they don't select a song, but instead click on another field to work on I get "The Microsoft Jet database engine cannot find a record in the table tblSongTitles with the key matching field(s) 'fldSongsLookup _com'."

    I know why this is popping up. Because by not selecting something, Access isn't finding their choice among the filtered list and is producing an error, but I wish to find a way of letting Access allow them to not choose anything without producing an error.

    Is there a way of letting access let them NOT choose something on a combo box filtered via query based on another combo box?

    Weird question I know. Hope I have given all the information needed. Thanks for any help at all.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32633

    #2
    I believe the control value can be set to Null. This would be equivalent to the operator using the Delete key to clear the selection.

    Are you interested in doing it from the code's perspective or as the user?

    Comment

    • wordbrew
      New Member
      • Oct 2009
      • 29

      #3
      Hey NeoPa,

      Good to talk to you again.

      I believe from a Code's perspective. I just want to bypass any chance of someone clicking on the selection, but for whatever reason they don't choose anything, and allow them to continue on. Right now if the combo is clicked but nothing is chosen from the drop down, it leaves the box empty, but with a blinking cursor, and then if they click anything else but the box, they get the jet error cause a blank value wasn't part of the filtered drop selection.

      Thank you for any help or insight.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        Ah, That's a bit different. It seems like they have already selected something, but in this case it is invalid. Curious.

        What do you have as the record source of the ComboBox, and what is an acceptable value in the field it's bound to?

        Comment

        Working...