Share via

Open form based on combo box selection

Anonymous
2017-02-22T15:23:33+00:00

I'm trying to open a popup form (frmForRemarksPopup) based on the selection in a combo box on a form named qryAssessmentDetailforSubform in order to add remarks. 

I want the frmForRemarksPopup to appear in order to better bring attention to the user that they must make a remark as to why they selected "Below Expectations" in the combo box. 

Remarks is one of the fields in the "qryAssessmentDetailforSubform" form but is not visible although I would like it to be visible once the user has returned to "qryAssessmentDetailforSubform" after inseting remarks into the popup.

So...The popup form is for remarks and only appears if "Below Expectations" is selected in the combo box. I think this is a start on how the vba needs to be structured but have not been successful in creating the VBA syntax.

Private Sub cboRanking_AfterUpdate()

If cboRanking = "Below Expectations" Then

DoCmd.OpenForm frmForRemarksPopup

End If

frmForRemarksPopup has two fields.  AssessmentSessionID and Remarks - memo field.

The source form (qryAssessmentDetailforSubForm) has cboRanking field that displays four options.

The common fields are AssessmentSessionID.

I need some help with the VBA code.

Thanks

Rob

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

10 answers

Sort by: Most helpful
  1. Anonymous
    2017-02-22T16:07:04+00:00

    You can reference the second column of the combo box by means of its Column property:

    Private Sub cboRanking_AfterUpdate()

         If cboRanking.Column(1) = "Below Expectations" Then

         DoCmd.OpenForm "frmForRemarksPopup"

    End If

    The Column property is zero-based, so Column(1) references the second column.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2017-02-22T16:03:22+00:00

    Thanks Daniel - should there be two End If's in that statement?

    I am getting this error:

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2017-02-22T15:56:05+00:00

    There are two columns and the associated column is (I think) RankingID which is numeric.  Should I be using the numeric value instead of the text value of "Below Expectations"?

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2017-02-22T15:49:01+00:00

    Hi,

    all depends from combo-box row-source. How many fields have you? Wich is the associated column?

    Ciao Mimmo

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2017-02-22T15:45:08+00:00

    I'm thinking something more along the lines of:

    Private Sub cboRanking_AfterUpdate()

        If cboRanking = "Below Expectations" Then

            DoCmd.OpenForm "frmForRemarksPopup", acNormal, , _

                           "[AssessmentSessionID]=" & Me.AssessmentSessionID, , acDialog

        End If

    End If

    Was this answer helpful?

    0 comments No comments