Filtering a combo box linked to a form

G

gazelle

I am experiencing a slightly different problem with filtering combo boxes.

I am developing a form which is linked to a table which contains 2 combo-boxes drawing data from 2 additional tables and saving the results in the main table linked to the form. I am trying to get the second combo box to filter what records it displays based on a selection in the first combo box.

I have used the following code I found on the net to filter the records.

Private Sub Propert_Id_AfterUpdate()
Dim sPremisesSource As String
sPremisesSource = "SELECT Premises.Premises_Id, Premises.Premises_Description " & _
"FROM Premises " & _
"WHERE Property_Id = " & Me.cmbPropterty_Id.Value
Me.cmbPremises_Id.RowSource = sPremisesSource
Me.cmbPremises_Id.Requery
End Sub

The problem I face, however, is that every time I make a selection in the second combo-box, it resets the value of that field in each record in the database.

Does anyone have any ideas about how to limit the selection to the particular record?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top