locked
Cascading Combo Boxes RRS feed

  • Question

  • Hi

    I have managed to create 2 cascading combo boxes which work successfully but for one thing.  cboModel delivers only the entries associated with cboMake.  This works fine when creating a new record but not when moving from one record to another on the main form.  If I move to the next record, cboModel delivers the entries associated with whatever entry was in cboMake on the previous record - not the current one.  This is remedied by refreshing the current record.  I have included a Me.Refresh in the On Current event of the main form which does resolve the problem automatically but I'm not convinced this is the correct way to resolve this issue.

    Could anybody advise if this is suitable or is there a better way?

    Thanks

    Chris

    Wednesday, November 11, 2015 11:28 AM

Answers

  • You might want to try a Requery in the controls “On Got Focus” event.

    Private Sub cboMake_GotFocus()
    Me.cboMake.Requery
    End Sub

    Private Sub cboModel_GotFocus()
    Me.cboModel.Requery
    End Sub


    If this post answered or helped you find the answer to your question, please mark it as such for other Forum users knowledge.

    • Marked as answer by ChrisParkin Wednesday, November 11, 2015 2:16 PM
    Wednesday, November 11, 2015 2:04 PM

All replies

  • You might want to try a Requery in the controls “On Got Focus” event.

    Private Sub cboMake_GotFocus()
    Me.cboMake.Requery
    End Sub

    Private Sub cboModel_GotFocus()
    Me.cboModel.Requery
    End Sub


    If this post answered or helped you find the answer to your question, please mark it as such for other Forum users knowledge.

    • Marked as answer by ChrisParkin Wednesday, November 11, 2015 2:16 PM
    Wednesday, November 11, 2015 2:04 PM
  • Thanks for that; that works just as well too.

    So would this be a situation where there is more than one resolution that are both acceptable, or is the Requery method the correct way to do it?

    Wednesday, November 11, 2015 2:16 PM
  • Requery will get newly added data Refresh wont.

    A more elaborate explanation about the differences can be found on the web.


    If this post answered or helped you find the answer to your question, please mark it as such for other Forum users knowledge.

    Wednesday, November 11, 2015 2:28 PM
  • Ah, I see.  Thanks.  I should take a look at those differences for future reference.
    Wednesday, November 11, 2015 2:37 PM