Prompted for a value for combo box value

  • Thread starter Thread starter JeffSomDal
  • Start date Start date
J

JeffSomDal

I am using the following Event Procedure to limit the recordset of a
subsequent combo box; however, I am prompted "Enter Parameter Value:
Me!CountryID". What is necessary to have this execute without having to
enter a value for this prompt?

When I supply an appropriate value for the prompt, the subsequent combo box
displays the corresponding recordset. So, I believe the logic of the code is
essentially correct.

Private Sub CountryID_AfterUpdate()
' Update the row source of the AppellationID combo box
' when the user makes a selection in the CountryID
' combo box.
Me.AppellationID.RowSource = "SELECT tAppellation.AppellationID,
tAppellation.AppellationName, " & _

"tAppellationClassification.AppellationClassificationNameDisplay, " & _
"tCountry.CountryName, tCountry.CountryID " & _
"FROM (tAppellation INNER JOIN tCountry ON
tAppellation.CountryID = tCountry.CountryID) " & _
"INNER JOIN tAppellationClassification ON
tAppellation.AppellationClassificationID = " & _

"tAppellationClassification.AppellationClassificationID " & _
"WHERE (((tCountry.CountryID) = Me!CountryID))
" & _
"ORDER BY tAppellation.AppellationName;"

Me.AppellationID = Me.AppellationID.ItemData(0)

End Sub
 
I am using the following Event Procedure to limit the recordset of a
subsequent combo box; however, I am prompted "Enter Parameter Value:
Me!CountryID". What is necessary to have this execute without having to
enter a value for this prompt?

When I supply an appropriate value for the prompt, the subsequent combo box
displays the corresponding recordset. So, I believe the logic of the code is
essentially correct.

Private Sub CountryID_AfterUpdate()
' Update the row source of the AppellationID combo box
' when the user makes a selection in the CountryID
' combo box.
Me.AppellationID.RowSource = "SELECT tAppellation.AppellationID,
tAppellation.AppellationName, " & _

"tAppellationClassification.AppellationClassificationNameDisplay, " & _
"tCountry.CountryName, tCountry.CountryID " & _
"FROM (tAppellation INNER JOIN tCountry ON
tAppellation.CountryID = tCountry.CountryID) " & _
"INNER JOIN tAppellationClassification ON
tAppellation.AppellationClassificationID = " & _

"tAppellationClassification.AppellationClassificationID " & _
"WHERE (((tCountry.CountryID) = Me!CountryID))
" & _
"ORDER BY tAppellation.AppellationName;"

Me.AppellationID = Me.AppellationID.ItemData(0)

End Sub

The Query knows nothing about the value of Me!. Replace Me! with
Forms!NameOfYourForm! instead.
 
Back
Top